# Assigning/Removing tags to location
When you would like to assign/remove a tag to a location, then the services leverages the /locations/{id}/tags
endpoints.
# Assigning tags to location
# Building your request
Note: This is a temporary endpoint that is not supported by JSON:API and will eventually be replace by Relationships
Ensure that you authenticate the request with the JWT you've previously obtained, by passing the JWT as an Authorization
header.
Great, let's assign a tag to a location. To do so, we will call the
POST /locations/{id}/tags/{tagId}
endpoint.
This endpoint requires some additional core information, such as:
tagId
- the corresponding id of the tag that would be assigned to this location.
# Sample request:
In our example, we're going to be assigning a tag to the location
# Sample response:
{
"data":
{
"type": "location",
"attributes": {
"id": "1009843199016960000",
"name": "Benevity",
"address": {
"addressLine": "611 Meredith Rd",
"country": "Canada",
"district": "Alberta",
"locality": "Calgary",
"postalCode": "T2E 2W5",
"geoCoordinate": {
"latitude": 0,
"longitude": 0
}
},
"phoneNumber": "+14035555556",
"referenceId": "810e95f6-de45-478a-bc8c-3d94379fe002",
"tags": [
{
"_id": "1016528404788281344",
"name": "Area",
"value": "East"
}
],
"contacts": []
}
}
}
# Removing tag to location
# Building your request
Let's remove the assigned tag in the location! All that you have to do now, is to tell us to process the request. To do so, we will call the DELETE /locations/{id}/tags/{tagId}
endpoint.
# Sample request:
In our example, we're going to be updaing a contact information in the location
# Response Details:
On successful deletion, 204 code is returned with no content.
# 🚀 ☀️ ⭐️ Congratulations! ⭐️ ☀️ 🚀
You have now assigned a tag to the location, to help your users drive further goodness in the world!