Update data in an index layer
You can update the index records in an index layer by specifying indexes to add and ids to remove in request body.
- Obtain an authorization token.
- Use the
api-lookup
v1
API to get API base URLs. - Use the
index
v1
API to update index records.
Obtain an authorization token
Obtain an authorization token for your HTTP requests. For instructions, see the Identity & Access Management Guide.
Get API base URLs
Use the API Lookup service to get the API endpoints for the index
v1
API of the catalog containing the index layer with ids you want to delete.
For instructions, see the API Lookup Developer's Guide.
Update data
To update index records in the index layer, you must specify "additions" and "removals" in your request body, "deleteBlob" is optional:
- Additions are the index records you defined to insert into the index layer. The additions must follow the validation rules and constraints listed in Publish to an index layer
- Removals are the ids of the index records in the index layer. If the id related index record exists in the index layer, the index record will be removed, otherwise it will not make change to the index layer.
- DeleteBlob is a true/false flag. Set it to
true
if you want to delete the data from blob storage corresponding to the index records as well. By default, it is false
. - Even if DeleteBlob is
true
, the blob data will continue to be available for 24 hours after update request is completed successfully.
PUT /<Base path for the index API from the API Lookup Service>/layers/<Layer ID> HTTP/1.1
Host: <Hostname for the index API from the API Lookup Service>
Authorization: Bearer <Authorization Token>
Content-Type: <Content type configured for the target layer>
Cache-Control: no-cache
{
"additions": [
{
"checksum": "checksum",
"fields": {
"ingestionTime": 1567702800000,
"tileId": 321535565,
"eventType": "type0"
},
"id": "40336c2b-591a-4472-a270-a91cafa4633a",
"metadata": "",
"size": 453
}
],
"deleteBlob": false,
"removals": [
"e07191de-8ab8-49f5-a11d-8240e1b93ab7",
"99e0bde0-935c-4382-b940-fe0d2cf2ec23"
]
}
Note
- The maximum number of index records in the additions of one index update API call is 2000.
- The maximum number of ids in the removals of one index update API call is 2000.