Delegate And Deallocate INRs From NIR's Pool Delegations
This tutorial assumes that you have an access token. If you do not have an access token, see Authentication for details on how to get one.
Delegate INRs From NIR’s pool delegations
To delegate INRs from NIR’s pool delegations to a subaccount, submit a nir-delegation POST request. Prior to submitting the request, contact details need to be provided by preferably setting default entities and Whois maintainers or alternatively setting a Whois template. This information is needed to inform parts of the delegation record created in Whois and RDAP.
(Note: The delegation request will fail if contact details is not provided.)
# Configure the access token.
$ export TOKEN=$access_token
# Configure the API base URL.
$ export BASE_URL=https://registry-testbed.apnic.net/nir-api
# Create an ASN NIR delegation.
$ curl -s \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-X POST $BASE_URL/nir-delegations/asn \
--data-binary @- << EOF | jq
{
"type": "ALLOCATED",
"networkName": "SUB1-NETNAME",
"description": "subaccount 1 asn allocation",
"resources": "123",
"subaccountId": 1
}
EOF
{
"_links": {
"api:tasks": {
"href": "https://registry-testbed.apnic.net/nir-api/tasks/3"
},
"curies": [
{
"href": "https://registry-testbed.apnic.net/nir-api/docs/overview#{rel}",
"name": "api",
"templated": true
}
]
}
}
To fetch the task object:
$ curl -s \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
$BASE_URL/tasks/3 | jq
{
"id": 3,
"taskStatus": "SUCCESSFUL",
"response": {
"info": []
},
"_links": {
"self": {
"href": "https://registry-testbed.apnic.net/nir-api/tasks/3"
}
}
}
To deallocate a nir delegation for a subaccount
To deallocate IPv4 resource delegated from NIR’s pool delegations:
# Create a IPv6 nir delegation
$ curl -s \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-X POST "$BASE_URL/nir-delegations/ipv4/deallocate?subaccountId=2&resources=103.0.7.0/24" | jq
{
"_links": {
"api:tasks": {
"href": "https://registry-testbed.apnic.net/nir-api/tasks/4"
},
"curies": [
{
"href": "https://registry-testbed.apnic.net/nir-api/docs/overview#{rel}",
"name": "api",
"templated": true
}
]
}
}
To fetch the task object:
$ curl -s \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
$BASE_URL/tasks/4 | jq
{
"id": 4,
"taskStatus": "SUCCESSFUL",
"response": {
"info": []
},
"_links": {
"self": {
"href": "https://registry-testbed.apnic.net/nir-api/tasks/4"
}
}
}
Can't find what you're looking for? Please contact the Software team.