跳轉到

使用 API 建立 Port

本主題說明使用 API 建立 Port 的流程,包括如何查詢 Port 位置、驗證 Port 並確認費用、訂購 Port,以及下載 授權書(LOA)授權書(LOA)是客戶需要提交給其資料中心供應商的文件,以在其資料中心服務與其 Port 之間建立實體交叉連接(Cross Connect)。 LOA 會在客戶佈建新的 Port 時透過 Megaport Portal 提供。
。

開始之前,請先取得有效的 access token。如需詳細資訊,請參閱 建立 API 金鑰。

在 Postman 集合中查詢 Port 位置詳細資料

  1. 按一下左側導覽中的 Locations(位置),然後按一下 GET Locations (v3)(GET 位置(v3))。
    此要求不需要 Parameters 或 Body 資訊。

  2. 按一下 Send(送出) 以送出要求。

    GET {baseUrl}/v3/locations
    

    取得位置

    請確認要求是否成功,查看 Status: 200 OK,並在 Body 區段以 Pretty 格式顯示回應。

    此要求會傳回數百個 Port 位置。您可以按一下放大鏡,並在搜尋欄位輸入特定城市、資料中心或其他參數來搜尋。本範例使用 Digital Realty(倫敦)位置。

{
            "id": 89,
            "name": "Digital Realty London LHR20",
            "address": {
                "street": "227 Marsh Wall",
                "suburb": null,
                "city": "London",
                "state": null,
                "postcode": "E14 9SD",
                "country": "United Kingdom"
            },
            "dataCentre": {
                "id": 3,
                "name": "Digital Realty"
            },
            "metro": "London",
            "market": "UK",
            "status": "Active",
            "longitude": -0.012144,
            "latitude": 51.499714,
            "orderingMessage": null,
            "diversityZones": {
                "red": {
                    "mcrSpeedMbps": [
                        5000,
                        100000,
                        1000,
                        25000,
                        10000,
                        2500,
                        50000
                    ],
                    "megaportSpeedMbps": [
                        100000,
                        10000,
                        1000
                    ],
                    "mveMaxCpuCoreCount": null,
                    "mveAvailable": true
                },
                "blue": {
                    "mcrSpeedMbps": [
                        1000,
                        2500,
                        5000,
                        10000
                    ],
                    "megaportSpeedMbps": [
                        1000,
                        10000,
                        100000
                    ],
                    "mveMaxCpuCoreCount": null,
                    "mveAvailable": true
                }
            },
            "productAddOns": {
                "crossConnect": {
                    "available": false,
                    "type": null
                }
            }
        }

若要建立一個 Port,您需要 market 值和 id 值。本範例中,market 為 UK,資料中心 ID 為 89。

測試並驗證 Port 訂單

  1. 在 Postman 的左側導覽中,展開 Ports 資料夾,並選取 POST Validate Port Order (v3)。

  2. 在 Body 中更新 locationId(89)、term(月數 - 1、12、24、36、48 或 60)、productName(您想為 Port 命名的名稱)、portSpeed(1000、10000 或 100000 Mbps),以及 market(UK),然後點擊 Send。

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

成功的回應會通過驗證,並顯示 200 OK 狀態。回應中也會包含服務的價格細節。

{
    "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"
        }
    ]
}

訂購已驗證的 Port

  1. 在已驗證的 Port 要求且已審閱費用資訊後,將 POST Validate Port Order (v3)(POST 驗證 Port 訂購(v3)) 的 Body 複製,並貼到 POST Buy Port (v3)(POST 購買 Port(v3)) 的 Body 中。

    重要

    如果您在 api.megaport.com 執行此呼叫,您的帳戶將會因該服務而被收費。或者,您也可以像這些範例一樣,使用測試環境的 API 進行佈建且不會產生費用。

  2. 送出要求。
    成功的回應會包含 technicalServiceUid,其值與 productUid 相同。
    在本範例中,此值為 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
        }
    ]
}

新的 Port 現已出現在您的作業環境中,可能是 portal.megaport.com 或 portal-staging.megaport.com

新的 API Port

提示

若要檢視此範例中使用之要求的所有選項,請參閱 https://dev.megaport.com。

下載授權書(LOA)

建立 Port 之後,您可以下載 LOA。

備註

在您能下載 LOA 之前,該 Port 的 Provisioning Status 必須為 Configured。

下載 LOA

  1. 在 Postman 的左側導覽中展開 Ports(連接埠),並選取 GET Regenerate LOA for Megaport Service(GET 為 Megaport 服務重新產生 LOA)。

  2. 在 GET 指令中,將 productID 取代為建立 Port 時產生的值。

  3. 送出要求。

    當回應為 200 OK 時,Body 區段會顯示以下訊息:

    此回應無法預覽。  
    請下載回應並使用適當的應用程式開啟。
    

    會出現此訊息是因為 LOA 為 PDF 文件,必須下載後才能開啟。若要下載,請在 Postman 中按一下 Save Response(儲存回應),將該 PDF 儲存到方便的路徑。