Creating a Port with the API

This topic steps through the API procedure to create a Port, including how to look up Port locations, validate the Port and determine the cost, order the Port, and download an LOA. An example in cURL appears after the Postman example.

To look up Port location details in the Postman collection

  1. Click Lists for Ordering in the left navigation and click GET locations.
    This request has the same Content-Type and X-Auth-Token headers as the login request and it is not expecting Parameters or Body information.
  2. Click Send to make a GET request.

    GET {API Server URL}/v2/locations
    

    Get locations

    Ensure the request was successful by looking for Status: 200 OK and display the response in the Body section in the Pretty format.

    The request returns hundreds of Port locations. You can search by clicking the magnifying glass and entering a specific city, data center, or other parameter in the search field. This example uses the Digital Realty, London location.

    {
            "country": "United Kingdom",
            "liveDate": 1467331200000,
            "siteCode": "lon-tc1",
            "networkRegion": "MP1",
            "address": {
                "country": "United Kingdom",
                "city": "London",
                "street": "227 Marsh Wall",
                "postcode": "E14 9SD",
                "suburb": null,
                "state": null
            },
            "campus": "campus_deprecated",
            "latitude": 51.499714,
            "products": {
                "mcr": false,
                "megaport": [
                    1,
                    10,
                    100
                ]
            },
            "market": "UK",
            "metro": "London",
            "name": "Digital Realty LHR20",
            "vRouterAvailable": false,
            "id": 89,
            "dc": {
                "name": "Digital Telx",
                "id": 3
            },
            "status": "Active",
            "longitude": -0.012144,
            "ordering_message": null
        }

To create a Port, you need the market value and id value. In this example, the market is UK and the data center ID is 89.

To test and validate the Port order

  1. In Postman, expand API Orders in the left navigation and select Validate Port Order.

  2. Update the Body with the locationId (89), term (number of months - 1, 12, or 36), productName (whatever name you want for your Port), portSpeed (1000, 10000, or 100000 Mbps), and market (UK) and click Send.
    Send the POST request to https://api-staging.megaport.com/v2/networkdesign/validate.

[
  {
    "locationId": 89,
    "term": 1,
    "locationUid": null,
    "productName": "API Port",
    "productType": "MEGAPORT",
    "createDate": 1452475039656,
    "portSpeed": 1000,
    "virtual": false,
    "market": "UK"
  }
]

A successful response passes validation and has a 200 OK status. The response also includes pricing details of the service.

{
    "message": "Validation passed",
    "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy",
    "data": [
        {
            "price": {
                "hourlySetup": 0,
                "dailySetup": 0,
                "monthlySetup": 0,
                "hourlyRate": 0,
                "dailyRate": 0,
                "monthlyRate": 500.00,
                "fixedRecurringCharge": 500.00,
                "postPaidBaseRate": "no base rate",
                "longHaulMbpsRate": 0,
                "mbpsRate": 0,
                "currency": "GBP",
                "key": "no key",
                "productType": "MEGAPORT",
                "empty": false
            },
            "serviceName": "API Port",
            "productType": "MEGAPORT",
            "productUid": "f9859fd3-344d-4a33-8cd2-a3b6ebfaaef0",
            "market": "UK",
            "string": "London"
        }
    ]
}

To order the validated Port

  1. With a validated the Port request and reviewed cost information, copy the body from POST Validate Port Order and paste into the body of POST Buy Port.

    Important

    If you make this call on api.megaport.com, your account will be charged for the service. Alternatively, you can provision against the staging API without charges, as in these examples.

  2. Send the request.
    A successful response includes a technicalServiceUid, which is the same as the productId and productUid. This ID is required in future steps and it will be helpful to create a Postman variable for this item.

  3. Select Edit on your Postman Collection and add a new variable called productId and paste in the Port productId. For our example, use a49cf3f1-20a1-4390-93aa-5005bdafe3d7.

{
    "message": "MEGAPORT [a49cf3f1-20a1-4390-93aa-5005bdafe3d7] created. ",
    "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy",
    "data": [
        {
            "serviceName": "API Port",
            "name": "API Port",
            "secondaryName": null,
            "technicalServiceId": 68124,
            "technicalServiceUid": "a49cf3f1-20a1-4390-93aa-5005bdafe3d7",
            "requestedDate": 1588862976322,
            "configuredDate": null,
            "currentEstimatedDelivery": null,
            "companyName": "Megaport Lab",
            "companyId": 2278,
            "aggregationId": null,
            "lagPrimary": false,
            "billingContactName": null,
            "billingContactId": null,
            "adminContactName": null,
            "adminContactId": null,
            "technicalContactName": null,
            "technicalContactId": null,
            "salesName": null,
            "salesId": null,
            "billableId": 56333,
            "billableUsageAlgorithm": "NOT_POST_PAID",
            "productType": "MEGAPORT",
            "provisioningStatus": "DEPLOYABLE",
            "inAdvanceBillingStatus": "NOT_ACTIVATED",
            "provisioningItems": [],
            "tags": [],
            "vxcDistanceBand": null,
            "intercapPath": null,
            "marketplaceVisibility": true,
            "vxcPermitted": true,
            "vxcAutoApproval": false,
            "createDate": 1588862976322,
            "terminationDate": null,
            "contractStartDate": 1588860000000,
            "contractTermMonths": 1,
            "rateType": "MONTHLY",
            "trialAgreement": false,
            "payerCompanyId": null,
            "nonPayerCompanyId": null,
            "minimumSpeed": null,
            "maximumSpeed": null,
            "rateLimit": 10000,
            "errorMessage": null,
            "market": "UK",
            "accountManager": null,
            "promptUid": null,
            "components": [],
            "attributes": [],
            "aLocation": null,
            "bLocation": null,
            "aLocationId": null,
            "bLocationId": null,
            "attributeTags": {},  
            "createdBy":  "a51cc1c6-95a0-48c7-a5a0-e49d77a6c536",
            "buyoutPort": false,
            "virtual": false,
            "locked": false,
            "adminLocked": false
        }
    ]
}

The new Port now appears in your working environment, either portal.megaport.com or portal-staging.megaport.com.

New API Port

Tip

To see all options for the requests used in this example, see https://dev.megaport.com

Curl example - create a Port

curl --location --request POST 'https://api-staging.megaport.com/v2/networkdesign/buy' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: a7255188-f4de-423f-8b41-791bb9f534ef' \
--header 'Content-Type: text/plain' \
--data-raw '[
  {
    "locationId": 89,
    "term": 1,
    "locationUid": null,
    "productName": "API Port",
    "productType": "MEGAPORT",
    "createDate": 1452475039656,
    "portSpeed": 10000,
    "virtual": false,
    "market": "UK"
  }
]'

Download the Letter of Authorization

After you create your Port, you can download the Letter of Authorization (LOA).

Note

Before you can download the LOA, the Provisioning Status of the Port must be Configured.

To download the LOA

  1. In Postman, expand Documents in the left navigation and select GET Regenerate LOA for Megaport Service.

  2. In the GET command, replace the productID with the productID variable created during Port creation.

    Change the standard command:

    https://api-staging.megaport.com/v2/product/productId/loa

    to

    https://api-staging.megaport.com/v2/product/{{productId}}/loa

  3. Send the request.

    With a successful 200 OK response, this message appears in the body section

    This response could not be previewed. 
    Download the response to open it with an appropriate application.
    

    This message appears because the LOA is a PDF document and must be downloaded. To download, click Save Response in Postman and save the PDF to a convenient location.


Last update: