Troubleshooting the API
If you encounter problems with the API or with the Megaport Terraform solution, step through these troubleshooting actions.
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.
|Ensure API token is valid||Megaport API calls require a token that you get from a successful login. Your login token does not expire unless you log out, at which point the system invalidates the token.|
|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.
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
"message": "Bad session token - try logging in again."
- incorrect username, email, or password
- missing or incorrect token
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"
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
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):
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