# Bulk import Locations
When you would like to bulk upload locations with tags and contacts to the services , you would need to specifying descriptions about the locations, tags and contacts. If no geocordinates are provided, then the services use the bing maps (opens new window).
To perform this, we'll be leveraging the POST /locations/batch
endpoint.
# Building your request
Ensure that you authenticate the request with the JWT you've previously obtained, by passing the JWT as an Authorization
header.
Great, let's bulk upload some locations! All that you have to do now, is to tell us to process the request. To do so, we will call the POST /locations/batch
endpoint to do so.
This endpoint requires some additional core information, such as:
Bulk upload attributes:
The services use atomic:operations where in we specify Add, Update or Remove operations
name
- the name of the location.referenceId
- An unique Id for the location, this value is supplied by the client and can be used to reference existing Id used in the client's existing systems.phoneNumber
- Phone number of the Location.address
- Text description of the Location.addressLine
- Name and number of the streetcountry
- Country ISO code of the Locationdistrict
- Province/District of the Location.locality
- City of the Location.postalCode
- Zip/Postal code of the Location.geoCoordinate
- Geo coordinate of the Location.latitude
- Latitude of the Location.longitude
- Longitude of the Location.
tags
- Description of the Tocation.name
- Name of the Tag.value
- Value of the Tag.
contacts
- Description of the Contact.firstName
- First name of the Contact.lastName
- Last name of the Contact.emailAddress
- Email address of the Contact. This must be a unique and valid email address, not used by another contact.isPrimary
- true/false - When true, this is the primary contact. Also, the previously assigned primary contact, if any, would become non-primary.
# Sample request:
In our example, we're going to be bulk uploading a location
# Sample response:
{
"atomic:results": [
{
"data": {
"type": "location",
"attributes": {
"id": "1016751984465674240",
"name": "Location Name 1",
"address": {
"addressLine": "611 Meredith Rd",
"country": "Canada",
"district": "Alberta",
"locality": "Calgary",
"postalCode": "T2E 2W5",
"geoCoordinate": {
"latitude": 51.05161,
"longitude": -114.05103
}
},
"phoneNumber": "+14035555556",
"referenceId": "Location Name 1",
"tags": [
{
"_id": "1016751982624374784",
"name": "Causes",
"value": "Causes"
},
{
"_id": "1016751982628569088",
"name": "Organization",
"value": "Organization"
},
{
"_id": "1016751982628569089",
"name": "Foundation",
"value": "Foundation"
}
],
"contacts": [
{
"id": "1016751984524394496",
"contactId": "1016751982888615936",
"locationId": "1016751984465674240",
"isPrimary": false,
"firstName": "harry",
"lastName": "potter",
"emailAddress": "harry.potter@someEmailProviderName.com"
}
]
}
}
},
{
"data": {
"type": "location",
"attributes": {
"id": "1016751984788635649",
"name": "Location Name 3",
"address": {
"addressLine": "611 Meredith Rd",
"country": "Canada",
"district": "Alberta",
"locality": "Calgary",
"postalCode": "T2E 2W5",
"geoCoordinate": {
"latitude": 51.05161,
"longitude": -114.05103
}
},
"phoneNumber": "+14035555556",
"referenceId": "Location Name 3",
"tags": [
{
"_id": "1016751982628569090",
"name": "Shop",
"value": "Shop"
}
],
"contacts": [
{
"id": "1016751984792829952",
"contactId": "1016751982892810240",
"locationId": "1016751984788635649",
"isPrimary": false,
"firstName": "Percy",
"lastName": "Jackson",
"emailAddress": "percy.jackson@example.com"
}
]
}
}
},
{
"data": {
"type": "location",
"attributes": {
"id": "1016751984797024256",
"name": "Location Name 4",
"address": {
"addressLine": "6 Meredith Rd",
"country": "Canada",
"district": "Alberta",
"locality": "Calgary",
"postalCode": "T2E 2W5",
"geoCoordinate": {
"latitude": 51.05192,
"longitude": -114.05099
}
},
"phoneNumber": "+14035555559",
"referenceId": "Location Name 4",
"tags": [
{
"_id": "1016751982624374784",
"name": "Causes",
"value": "Causes"
},
{
"_id": "1016751982628569088",
"name": "Organization",
"value": "Organization"
},
{
"_id": "1016751982628569089",
"name": "Foundation",
"value": "Foundation"
}
],
"contacts": [
{
"id": "1016751984801218560",
"contactId": "1016751982892810241",
"locationId": "1016751984797024256",
"isPrimary": false,
"firstName": "james",
"lastName": "potter",
"emailAddress": "james.potter@example.com"
}
]
}
}
},
{
"data": {
"type": "location",
"attributes": {
"id": "1016751984801218561",
"name": "Location Name 5",
"address": {
"addressLine": "61 Meredith Rd",
"country": "Canada",
"district": "Alberta",
"locality": "Calgary",
"postalCode": "T2E 2W5",
"geoCoordinate": {
"latitude": 51.05192,
"longitude": -114.05099
}
},
"phoneNumber": "+14035555558",
"referenceId": "Location Name 5",
"tags": [
{
"_id": "1016751982628569090",
"name": "Shop",
"value": "Shop"
}
],
"contacts": [
{
"id": "1016751984805412864",
"contactId": "1016751982892810242",
"locationId": "1016751984801218561",
"isPrimary": false,
"firstName": "arya",
"lastName": "stark",
"emailAddress": "arya.stark@example.com"
}
]
}
}
}
]
}
# 🚀 ☀️ ⭐️ Congratulations! ⭐️ ☀️ 🚀
You have now bulk uploades entities such as locations and its assigned contacts and tags and received the response, to help your users drive further goodness in the world!