To update a resource, a PUT request is sent to the URI of the resource to be updated. The
body of the PUT request must contain the complete representation of the resource.
Tip:
- A resource’s URI can be found in its
_links.self.href
field when the response media type isapplication/json+hal
. - The
_links
field is considered metadata and is not required for PUT request bodies.
In the following example, a GET request is sent to the URI for a Resource Record
resource. The resource received from the GET request is then sent back to the same URI
in a PUT request, with the name
field modified from "bc1" to "bc2". The
API responds with a 200 OK status code and the updated resource.
Request
GET http://{Address_Manager_IP}/api/v2/resourceRecords/100980
Authorization: Basic {basicAuthenticationCredentials}
Response
HTTP/1.1 200 OK
Content-Type: application/hal+json
{
"id": 100980,
"type": "HostRecord",
"name": "bc1",
"configuration": {
"id": 100946,
"type": "Configuration",
"name": "config-1",
"_links": {
"self": {
"href": "/api/v2/configurations/100946"
}
}
},
"absoluteName": "bc1.bluecatlabs.com",
...
"_links": {
"self": {
"href": "/api/v2/resourceRecords/100980"
},
"collection": {
"href": "/api/v2/zones/100976/resourceRecords"
},
"up": {
"href": "/api/v2/zones/100976"
},
"addresses": {
"href": "/api/v2/resourceRecords/100980/addresses"
},
"dependentRecords": {
"href": "/api/v2/resourceRecords/100980/dependentRecords"
},
...
}
}
Request
PUT http://{Address_Manager_IP}/api/v2/resourceRecords/100980
Authorization: Basic {basicAuthenticationCredentials}
Content-Type: application/hal+json
{
"id": 100980,
"type": "HostRecord",
"name": "bc2",
"configuration": {
"id": 100946,
"type": "Configuration",
"name": "config-1",
"_links": {
"self": {
"href": "/api/v2/configurations/100946"
}
}
},
"absoluteName": "bc1.bluecatlabs.com",
...
"_links": {
"self": {
"href": "/api/v2/resourceRecords/100980"
},
"collection": {
"href": "/api/v2/zones/100976/resourceRecords"
},
"up": {
"href": "/api/v2/zones/100976"
},
"addresses": {
"href": "/api/v2/resourceRecords/100980/addresses"
},
"dependentRecords": {
"href": "/api/v2/resourceRecords/100980/dependentRecords"
},
...
}
}
Response
HTTP/1.1 200 OK
Content-Type: application/hal+json
{
"id": 100980,
"type": "HostRecord",
"name": "bc2",
"configuration": {
"id": 100946,
"type": "Configuration",
"name": "config-1",
"_links": {
"self": {
"href": "/api/v2/configurations/100946"
}
}
},
"absoluteName": "bc2.bluecatlabs.com",
...
"_links": {
"self": {
"href": "/api/v2/resourceRecords/100980"
},
"collection": {
"href": "/api/v2/zones/100976/resourceRecords"
},
"up": {
"href": "/api/v2/zones/100976"
},
"addresses": {
"href": "/api/v2/resourceRecords/100980/addresses"
},
"dependentRecords": {
"href": "/api/v2/resourceRecords/100980/dependentRecords"
},
...
}
}