Bulk update locations
POST api/locations/bulk_update
Bulk update the address data associated with one or more locations.
In order to perform this action, the following conditions must be met:
- The user must have the following SC//Reliantâ„¢ Platform Manager capabilities.
Import locations- This capability allows a user to use the import CSV function to add or update locations.List previous location imports- This capability allows a user to list the location imports in SC//Reliant Platform Manager.
Request syntax
post api/locations/bulk_update '{"locations":[{"id":integer,"name":"<string>","city":"<string>","state":"<string>","addressline1":"<string>","addressline2":"<string>","zipcode":"<string>","country":"<string>"}]}'
Request parameters
The request accepts a locations array in JSON format. Each object in the array accepts the following data.
| Parameter | Type | Description | Required | Default value |
|---|---|---|---|---|
id | Integer | The ID of an existing location to update. If this value is omitted, a new location is created. | No | N/A |
name | String | The name of the location. | Yes | N/A |
city | String | The city where the location is physically located. | No | Austin |
state | String | The state where the location is physically located. | No | TX |
addressline1 | String | The first line of the physical address of the location. | No | 123 Please Update Me |
addressline2 | String | The second line of the physical address of the location. | No | N/A |
zipcode | String | The zip code where the location is physically located. | No | 11111 |
country | String | The country where the location is physically located. | No | US |
Response syntax
{
"created": {
"count": integer,
"locations": [
{
"id": integer,
"name": "string"
}
]
},
"updated": {
"count": integer,
"locations": [
{
"id": integer,
"name": "string"
}
]
},
"errors": {
"count": integer,
"locations": [
{
"id": integer,
"name": "string",
"method": "string",
"errors": [
"string",
"string"
]
},
{
"name": "string",
"method": "string",
"errors": [
"string"
]
}
]
}
}
Response parameters
If the action is successful, an HTTP 200 response is returned. The following data is returned in JSON format.
| Field | Type | Description |
|---|---|---|
created | Object | The count and details of the locations created. |
updated | Object | The count and details of the locations updated. |
errors | Object | The count and details of the locations that were unable to be created or updated due to an error. |
Errors
The following are errors returned by this API. For a complete list of common errors, see Common errors.
| Code | Message | Cause |
|---|---|---|
| 422 | Validation Failed: addressline1, city, state, zipcode, country provide all or none of parameters | The addressline1, city, state, zipcode, and country fields must either always be present, or omitted in the request. |
Examples
Example: Update two existing locations
This example updates the data associated with two locations, Test Location 1 with location ID 25844 and Test Location 2 with location ID 25845, with new physical locations.
ruby api.rb <customer_code> post /api/locations/bulk_update '{"locations": [{"id": 25844,"name": "Location 1","city": "Austin","state": "TX","addressline1": "123 Test Way","addressline2": "Suite 100","zipcode": "11111","country": "US"},{"id": 25845,"name": "Location 2","city": "Austin","state": "TX","addressline1": "321 Test Way","zipcode": "11111","country": "US"}]}'
Response
{
"created": {
"count": 0,
"locations": []
},
"updated": {
"count": 2,
"locations": [
{
"id": 25844,
"name": "Location 1"
},
{
"id": 25845,
"name": "Location 2"
}
]
},
"errors": {
"count": 0,
"locations": []
}
}