Bulk update locations

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.

ParameterTypeDescriptionRequiredDefault value
idIntegerThe ID of an existing location to update. If this value is omitted, a new location is created.NoN/A
nameStringThe name of the location.YesN/A
cityStringThe city where the location is physically located.NoAustin
stateStringThe state where the location is physically located.NoTX
addressline1StringThe first line of the physical address of the location.No123 Please Update Me
addressline2StringThe second line of the physical address of the location.NoN/A
zipcodeStringThe zip code where the location is physically located.No11111
countryStringThe country where the location is physically located.NoUS

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.

FieldTypeDescription
createdObjectThe count and details of the locations created.
updatedObjectThe count and details of the locations updated.
errorsObjectThe 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.

CodeMessageCause
422Validation Failed: addressline1, city, state, zipcode, country provide all or none of parametersThe 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": []
    }
}