First Mile Locations
The first mile location is the nuu:bit PoP that has the lowest latency to the content origin. To create a domain, it is necessary to select the correct first mile location. This is typically the same city as the origin data center. If the city of the origin data center is not listed, select the next nearest city.
To show all of the first mile locations, nuu:bit provides the following API call:
https://api.nuubit.net/v1/locations/firstmile
cURL example:
curl -u '[email protected]:password' https://api.nuubit.net/v1/locations/firstmile
Response body:
[
{
"locationName": "San Jose, CA",
"id": "5588868cbde7a0d00338ce8e"
},
{
"locationName": "New York, NY",
"id": "55a56fa6476c10c329a90741"
}
]
Create a Domain
To create a domain, use the following POST to the api.nuubit.net endpoint.
https://api.nuubit.net/v1/domains/
cURL example:
curl -u '[email protected]:password' -X POST -H 'Content-Type: application/json' -T Domain.json https://api.nuubit.net/v1/domains
Using the response from the first mile request, select the nearest first mile location to the origin. The example JSON (Domain.json) would be the following:
{
"name": "www.example.com",
"origin_server": "origin.example.com",
"companyId": "5588869fbde7a0d00338ce8f",
"origin_server_location": "San Jose, CA",
"origin_host_header": "www.example.com",
"tolerance": "4000"
}
Body response:
{
"statusCode": 200,
"message": "Successfully created the domain",
"object_id": "55c0222fe9032a2d741b9f38"
}
Show the Domain
Take the object_id from body response of the domain create POST and use it to get the current configuration of the domain.
https://api.nuubit.net/v1/domains/55c0222fe9032a2d741b9f38
cURL Example:
curl -u '[email protected]:password' -H 'Content-Type: application/json' http://api.nuubit.net/v1/domains/55c0222fe9032a2d741b9f38
Body response:
{
"companyId": "5588869fbde7a0d00338ce8f",
"id": "55c0222fe9032a2d741b9f38",
"name": "www.example.com",
"origin_server": "origin.example.com",
"sync_status": "Success",
"tolerance": "4000",
"updated_at": "2015-08-04T02:24:14.204Z",
"created_at": "2015-08-04T02:23:43.759Z",
"origin_server_location": "San Jose, CA",
"origin_host_header": "www.example.com",
"cname": "www.example.com.nuubitcn.net"
}
0 Comments