使用 API 创建 MCR
本主题介绍使用 API 创建 MCR 的流程,包括如何查询 MCR 的位置,以及如何验证并完成订单。
在开始之前,请获取一个有效的访问令牌。有关详细信息,请参阅 创建 API 密钥。
在 Postman 集合中查询 MCR 的位置详细信息
-
在左侧导航中展开 Locations (位置) 文件夹,并单击 GET Locations (v3) (获取位置 (v3))。
此请求不需要参数或正文信息。 -
单击 Send (发送) 以发出一个 GET 请求。
GET {baseUrl}/v3/locations
通过查看 Status: 200 OK 来确认请求是否成功,并在 Body 部分以 Pretty 格式显示响应。
该请求会返回数百个 Megaport 位置。
-
单击放大镜,在响应中搜索一个站点,该站点的
diversityZones对象中包含mcrSpeedMbps,并且位于 US 市场。要在某个位置开通 MCR,
diversityZones对象中必须提供该端口速率。请检查该位置是否为 MCR 提供了可用的速率和多样性区域。
{
"id": 60,
"name": "CoreSite LA1",
"address": {
"street": "624 South Grand Avenue",
"suburb": null,
"city": "Los Angeles",
"state": "CA",
"postcode": "90017",
"country": "USA"
},
"dataCentre": {
"id": 18,
"name": "CoreSite"
},
"metro": "Los Angeles",
"market": "US",
"status": "Active",
"longitude": -118.25554,
"latitude": 34.04791,
"orderingMessage": null,
"diversityZones": {
"red": {
"mcrSpeedMbps": [
2500,
5000,
10000,
1000
],
"megaportSpeedMbps": [
1000,
10000,
100000
],
"mveMaxCpuCoreCount": null,
"mveAvailable": true
},
"blue": {
"mcrSpeedMbps": [
5000,
1000,
2500,
10000
],
"megaportSpeedMbps": [
1000,
100000,
10000
],
"mveMaxCpuCoreCount": null,
"mveAvailable": true
}
},
"productAddOns": {
"crossConnect": {
"available": true,
"type": "STANDARD"
}
}
}
要创建一个 MCR,你需要 id 值。在本例中,位置 ID 是 60。
测试和验证 MCR 订单
-
在 Postman 中,展开左侧导航的 Megaport Cloud Router (MCR),并选择 Validate MCR Order (v3)。
-
更新 Body 中的
locationId(60)、productName(你想为 MCR 命名的任何名称)、term(承诺期限的最少月份数:1、12、24、36、48 或 60),以及portSpeed(1000、2500、5000 或 10000 Mbps),然后点击 Send。 只有在你不想使用 Megaport 默认的 ASN(133937)时才需要填写 ASN 值。 添加分集区域。检查 location 结果,查看diversityZones下你的 MCR 位置可用的分集区域。 如果没有明确选择分集区域,在创建 MCR 时将会自动分配一个。POST {baseUrl}/v3/networkdesign/validate
[
{
"locationId":60,
"term": 12,
"promoCode": "promox3mnthfree2",
"productName":"Test MCR",
"productType":"MCR2",
"portSpeed":2500,
"config": {
"mcrAsn": 133937,
"diversityZone":"blue"
}
}
]
验证通过后会返回成功响应,并显示 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": 1440.00,
"fixedRecurringCharge": 0,
"postPaidBaseRate": "no base rate",
"longHaulMbpsRate": 0,
"mbpsRate": 6.000000000000000,
"currency": "USD",
"key": "no key",
"productType": "MCR2",
"empty": false
},
"serviceName": "API Test MCR",
"productType": "MCR2",
"productUid": "78aebd6b-7601-4331-82bc-dcd07f9f21a6",
"string": "Los Angeles"
}
]
}
订购已验证的 MCR
-
在 MCR 请求验证通过且已审核费用信息后,将 POST Validate MCR Order (v3) 的 Body 复制,并粘贴到 POST Buy MCR (v3) 的 Body 中。
重要
如果你在 api.megaport.com 调用此接口,你的账号将会被收取该服务费用。或者,你也可以使用 API 的预发布(测试)环境,不会产生费用,正如这些示例中所示。
-
发送请求。
此输出显示了一个成功的响应。
{
"message": "MCR2 [426fa830-4b66-41ad-95a1-197d55e074b1] created.",
"terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy",
"data": [
{
"serviceName": "Test MCR",
"name": "Test MCR",
"secondaryName": null,
"technicalServiceId": 187964,
"technicalServiceUid": "426fa830-4b66-41ad-95a1-197d55e074b1",
"requestedDate": 1707800936928,
"configuredDate": null,
"currentEstimatedDelivery": null,
"companyName": "Megaport Lab",
"companyId": 1153,
"billingContactName": null,
"billingContactId": null,
"adminContactName": null,
"adminContactId": null,
"technicalContactName": null,
"technicalContactId": null,
"salesName": null,
"salesId": null,
"billableId": 179527,
"billableUsageAlgorithm": null,
"productType": "MCR2",
"provisioningStatus": "DEPLOYABLE",
"failedReason": null,
"inAdvanceBillingStatus": null,
"provisioningItems": [],
"tags": [],
"vxcDistanceBand": null,
"intercapPath": null,
"marketplaceVisibility": false,
"vxcPermitted": true,
"vxcAutoApproval": false,
"createDate": 1707800936928,
"terminationDate": null,
"contractStartDate": null,
"contractTermMonths": 12,
"rateType": "MONTHLY",
"trialAgreement": false,
"payerCompanyId": null,
"nonPayerCompanyId": null,
"minimumSpeed": null,
"maximumSpeed": null,
"rateLimit": 2500,
"errorMessage": null,
"lagId": null,
"aggregationId": null,
"lagPrimary": null,
"market": "USA",
"accountManager": null,
"promptUid": null,
"components": [],
"attributes": [],
"aLocation": "lax-cs1",
"bLocation": null,
"aMetro": "Los Angeles",
"aCountry": "USA",
"aLocationId": 60,
"bLocationId": null,
"bMetro": null,
"bCountry": null,
"attributeTags": {},
"createdBy": "f39b8983-256e-4643-adec-9f0b5da09ab7",
"buyoutPort": false,
"virtual": true,
"locked": false,
"adminLocked": false,
"bgpShutdownDefault": false,
"originDomain": null
}
]
}
新的 MCR 现在会出现在你的工作环境中,可能是 portal.megaport.com 或 portal-staging.megaport.com。
提示
要查看此示例中使用的请求的所有选项,请参阅 https://dev.megaport.com。
接下来,创建指向该 MCR 的 VXC。
有关更多信息,请参阅: