Intro to REST APIs
  • 12 Mar 2024
  • 3 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Intro to REST APIs

  • Dark
    Light
  • PDF

Article Summary

I know I got your hopes up, but we're not going to regurgitate what's already widely documented all over the place on the web. If you don't know what REST stands for, take 6 minutes and read this intro. Then continue on to learn what you can do in Skylight performance analytics with them.
105536425b43a53ba6a123301d24e2ad4REST.png

If you're serious about using REST, you'll want to check out the following links as well:


Getting Started

Step 1 is to choose a tool - for the purposes of this Tutorial, I'll heavily recommend Postman. Without sounding too much like a salesperson for them, here are some of the reasons you should be using them:

  • Class leading product
  • Ability to share your APIs with a team of people via the shared workspaces
  • Support for environment variables that let you quickly switch between tenants or Skylight analytics instances
  • Support for OpenAPI standards, making the import of our specs pretty easy

Step 1 - Download the tool

Step 2 - Import Skylight analytics API specifications

Let's get you access to our wonderful selection of REST APIs!

image.png

  • Start Postman and choose to Import swagger.json file into Postman

1194154457978f0c9458c3b65ba60608ePostmanImport.png

  • Done!
    You'll notice that there are three folders for APIs, v1, v2, v3. Try to stick with the later versions of APIs for unless you cannot find the corresponding one from later revisions.

image.png

Step 3 - Setup some global and environment specific variables

Some times you want to be able to re-use the same API in different environments - use global and environment specific variables to help you out there. Then you can imbed variables within the URL or REST payload using double curly brackets {{ variable_name }} .

  • Find the environment settings cog in the top right corner

1194359429a3c635b981f704fc45ecbb5PostmanGlobalVars.png

  • Select the "Globals" option at the bottom of the manage environment page
  • Add a global parameter called "protocol" and set the value to "https". Yes, all communication between Postman and Skylight analytics will be super secure!

119436024dc41c11eb38845c309665c85PostmanGlobalProtocol.png

  • Add a new environment and add a "host" variable with the URL to your Skylight analytics tenant.

1194360995100c49ecf8b59a0ff85405bPostmanGSNEVar.png

  • Save and select your environment.

119436137027f479a3610322b371894bePostmanEnvSelection.png

  • Use the EYE icon to see your variables' values at any time.

119436401b105c75c43e431c26099f608PostmanEnvQuickLook.png

Step 5 - Get authenticated

Let's cover one more step before getting into some examples... authentication. We don't just let anyone issue APIs into Skylight analytics. You need to set up a session with Skylight analytics via a login request, where you'll get a token that Postman will magically send when you make other API requests. Just keep in mind that the token periodically expires, and you'll need to re-login and get a new one.

  • Use the search to filter the Skylight analytics request collection to find the "Login" API

image.png

  • Edit the URL to add {{protocol}} and {{host}} variables
  • Check out the body of the API request, and you'll notice it asks for two additional variables - {{username}} and {{password}}. You can edit your environment variables to add them or just fill in the values here... you won't need them in any other API so don't really need to make them variables unless you have different credentials for different environments.

119440062c0eba46425376444c5de7ad6Postmanlogin2.png

  • Send it in!
  • Check out the response and make sure received a successful response that includes: a 200 OK response code, relevant payload with details on your account, and authorization and cookie headers.

119440052271502f86743035f4cda082bPostmanlogin3.png


Examples

Try reseting someone's password (admin only)

If you're an admin, you have the capability of looking for users to find their IDs and can issue a password reset API to get a new onboarding URL for them.

  • Find all users using the "Retrieve a list of Users known to Skylight AAA" API

image.png

  • Search for the particular user you need to reset - note their ID number
  • Using the Reset a password for a User provisioned in Skylight AAA, specify the {{userid}} in the URL or in the params as the number noted above.

image.png

119443325056ba7b48de73f1b5333fd85PostmanpasswordReset2.png

  • Send that API, take the onboarding token from the returned payload and send it to the user so they can reset their password and resume their awesome work inside of Skylight analytics.

FYI - the onboarding URL is https:// {{host }}/ onboarding?token={{ onboarding token }}

© 2024 Accedian Networks Inc. All rights reserved. Accedian®, Accedian Networks®,  the Accedian logo™, Skylight™, Skylight Interceptor™ and per-packet intel™, are trademarks or registered trademarks of Accedian Networks Inc. To view a list of Accedian trademarks visit: http://accedian.com/legal/trademarks/. 


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.