Troubleshooting the API
If you encounter problems with the API or with the Megaport Terraform solution, step through these troubleshooting actions.
For API tutorials and a step-by-step guide, see Megaport API Overview. For a full reference, including working examples, see https://dev.megaport.com/.
To try out the API, we recommend the Postman client with the imported Megaport Collection; information on downloading and using Postman is in the documentation.
Troubleshooting actions
Action | Steps |
---|---|
Ensure API access token is valid | Megaport API calls require an access token that you can generate after creating an API key. An access token is required for authenticating API users, and allows temporary access to only the parts of the Megaport Portal that are required. Access tokens expire after a maximum of 24 hours, after which you need to generate a new access token. For more information, see Creating an API Key. |
Ensure API environment (URL) is correct | Ensure that the URLs you are using are for the intended environment.
|
Ensure API parameters are correct | The Megaport API uses standard HTTP response codes. Generally speaking, a 400 - Bad Request error is typically caused by missing or incorrect parameters. If you are receiving this error, double check your parameters. |
Ensure your API syntax is correct | The correct syntax is essential when interacting with the Megaport API. The Megaport API is based on REST, has predictable URLs, and accepts form-encoded request bodies. You can see examples of the correct calls on https://dev.megaport.com. Select your preferred language from the drop-down menu on this page, and you can see examples of how to do anything within the API environment. |
API Limits | General Rate Limit There is a rate limit of 500 requests in a rolling 5 minute period per IP address. Service Updates You can only make one service update every 5 minutes, and there is a maximum of 100 updates per month per service. Note: Currently, these are not hard limits, but Megaport monitors and reviews when limits are breached. If limit breaches occur, access could be blocked. |
Common API error messages
Login error
"message": "Bad session token - try logging in again."
Common causes:
- incorrect username, email, or password
- missing or incorrect token
Syntax error
HTTP Status 400 – Bad Request
The error commonly occurs when a required syntax is missing or incorrect.
Incorrect API URL
An example of the error that is related to incorrect the incorrect URL is:
“message”:” Service abcd1234 has wrong product type VXC”
For this scenario, the customer used this URL:
URL = "https://api-staging.megaport.com/v2/product/megaport/abcd1234-1234-1234-1234-abcdef123456/telemetry?from=1614283800000&to=1614284400000&type=BITS"
but the correct URL is:
URL = "https://api-staging.megaport.com/v2/product/vxc/abcd1234-1234-1234-1234-abcdef123456/telemetry?type=A_BITS&from=1614283800000&to=1614284400000"
Incorrect parameters
As an example, a customer reported no data output when requesting VXC telemetry for this time range:
- From: GMT: Tuesday, August 3, 2021 1:52:23 PM
- To: GMT: Tuesday, August 3, 2021, 1:57:23 PM
Syntax
https://api-staging.megaport.com/v2/product/vxc/abcd1234-1234-0000000000telemetry?type=A_BITS&from=1627998743&to=1627999043
Output
{“serviceUid”:”abcd1234-1234-0000000000”,”type”:”A_BITS”,”timeFrame”:{“from”:1627998743,”to:”1627999043},”data”:[ ]}
From the Get VXC Telemetry docs the From and To parameters must be set in milliseconds for each epoch value (so each value needed extra zeros at the end):
https://api-staging.megaport.com/v2/product/vxc/abcd1234-1234-0000000000telemetry?type=A_BITS&from=1627998743000&to=1627999043000
Megaport required data
If the troubleshooting actions do not resolve your issue, contact Megaport Support. With an API issue, Megaport will investigate and troubleshoot the issue at the back end.
To assist the investigation, provide the results of the tests you performed and any other relevant information, such as:
- Email/account used
- Date, time, and timezone of action and when the error occurred
- API configuration
- API URL
- Body data
- Endpoint parameters and syntax
- Error type and a screenshot of the error