Get Locations

Introduction

This API will be used to list all Locations in the system available to the User accessing the API - See Login Authentication API documentation for more information.

Locations are a layer of all user security filtering within the SafetyChain Software application. An example of how this Location information is structured within the UI.


Getting Started

All API requests require an authorization token – reference our Authentication page for more information

API Structure

POST api/integration/GetLocations

Required Request Parameters

NameLocationDescription
Authorization tokenHeaderSee Login Authentication API documentation
TakeBodyPaging the data (recommended default 100)
SkipBodyPaging the data (recommended default 0)
PageSizeBodyPaging the data (recommended default 100)
Filters
FullName
Location
BodyDefine Location request to receive the full path in response.
contains or equals
Operator

Request JSON

{
   "Data": {
        "Take": 100,
        "Skip": 0,
        "PageSize": 100,
        "ResourceType": ["Locations"],
        "Filter": {
            "Logic": "Or",
            "Filters": [{
                    "Field": "FullName",
                    "Value": "Locations > Poultry > Novato, CA",
                    "Operator": "contains"
                }
            ]
        }
    }
}

Request JSON Example using “itemcode” defined as SAP Code:

{
    "Data": {
        "Take": 100,
        "Skip": 0,
        "PageSize": 100,
        "ResourceType": ["Locations"],
        "Filter": {
            "Logic": "Or",
            "Filters": [{
                    "Field": "SAP Code",
                    "Value": "1350",
                    "Operator": "equals"
                }
            ]
        }
    }
}

Response Parameters

NameDescription
IDGUID that can be used in other API requests.
NameThe name within the UI, used within other API requests.
FullNameFull path of where the Location is located within the hierarchy
RequestErrorError object providing information if an error occurs
StatusIndicating the success of the API request

Response JSON

{
    "Data": [{
            "Id": "ee7cf7fd-6f4e-4ed2-bb6e-df0d29a0d511",
            "Name": "Novato, CA",
            "FullName": "Locations > Poultry > Novato, CA",
            "FieldValues": [{
                    "FieldId": "6211e1d5-38a2-40d1-b91d-38458245eda6",
                    "Id": 0,
                    "FieldName": "Division",
                    "Value": {
                        "Id": "bbda32a9-3b56-4280-a7d4-e2a4fb713429",
                        "Name": "Big Bird/Fowl"
                    }
                }, {
                    "FieldId": "241dff88-60e9-4165-868e-46924ef1e27f",
                    "Id": 0,
                    "FieldName": "Location Code",
                    "Value": {
                        "Id": "00000000-0000-0000-0000-000000000000",
                        "Name": "NOV"
                    }
                }, {
                    "FieldId": "de94bf26-4ca4-455c-b951-5a7e1f547abe",
                    "Id": 0,
                    "FieldName": "Jurisdiction",
                    "Value": {
                        "Id": "8cd385de-5162-417c-ac58-479beb870724",
                        "Name": "USDA"
                    }
                }, {
                    "FieldId": "425d380e-51d1-4176-b445-5e82c2dfedfd",
                    "Id": 0,
                    "FieldName": "Business Unit",
                    "Value": {
                        "Id": "27f3c436-2793-42be-b77f-da8281bd396d",
                        "Name": "Poultry"
                    }
                }, {
                    "FieldId": "791675ef-fd63-49e1-855a-900b23660ec6",
                    "Id": 0,
                    "FieldName": "SAP Code",
                    "Value": {
                        "Id": "00000000-0000-0000-0000-000000000000",
                        "Name": "1350"
                    }
                }, {
                    "FieldId": "7ff0bd07-a748-4edc-a767-9264c2c9fb7a",
                    "Id": 0,
                    "FieldName": "McDonalds ID",
                    "Value": {
                        "Id": "00000000-0000-0000-0000-000000000000",
                        "Name": null
                    }
                }, {
                    "FieldId": "06d59f5f-4eef-4a15-91de-9464795c2354",
                    "Id": 0,
                    "FieldName": "Establishment Number",
                    "Value": {
                        "Id": "00000000-0000-0000-0000-000000000000",
                        "Name": "P559"
                    }
                }, {
                    "FieldId": "2d1409b2-6564-4a4d-a29f-f4a763982180",
                    "Id": 0,
                    "FieldName": "McDonalds Supplier ID Code",
                    "Value": {
                        "Id": "00000000-0000-0000-0000-000000000000",
                        "Name": null
                    }
                }
            ]
        }
    ],
    "RequestError": null,
    "DetailedError": null,
    "Status": true,
    "Errors": null,
    "RefreshToken": false
}

Optional Request Parameters for filtering

NameLocationDescription
"Field": "FullName",Body within FiltersPulls the full path of the Resource Category
"Value": "",Body within FiltersInclude the name of the Resource or Resource Category. In the example below, Crisp Inc is the name of a Supplier Resource
"Operator": "contains", "equals"Body within FiltersRequired logic.