Logging In to the Megaport API
Megaport API calls require a token that you obtain following a successful login.
To set up your login and token details in Postman
- Click the Collections tab, click the three dots after the imported Megaport collection, and click Edit.
- Click the Variables tab and add a variable for username and define the value to be your Megaport ONE Portal username.
- Add another entry for password and enter your Megaport ONE Portal password.
- Click Update.
- Go to the Megaport collection and click Authentication > Log in with user details.
- Ensure your username and password variables are in the Params tab and click Send.
The response JSON object includes a 32-digit hexadecimal token.
- Copy the token.
- In the variables for the collection, add another entry for token and paste the token into the current value field.
Most API calls require the token generated from a successful login.
- Click Update.
Most API calls are now ready to use. All API calls are made over SSL/TLS, and every call is validated against the calling user account for appropriate permissions.
When you log in with a token, most requests include two important headers: Content-Type and X-Auth-Token. The X-Auth-Token points to the token variable.
Another way to log in is using cURL from a command console in the following format:
curl -X POST -d 'username=*myaccountid*&password=*mypassword*' 'https://api-staging.megaport.com/v2/login'
The dev.megaport.com site lets you see each API endpoint in multiple languages.
Last update: 2022-06-14