List Company Locations

An overview of the List Company Locations endpoint.

Endpoint Description

The List Company Locations endpoint provides the list of locations associated for a specific company setup within R1 Discover. This information is used for user and administrator alignments, this is important for both reporting and setting permissions.

HTTP Method

GET /api/v2/locations/{companyId}

Request

Headers:

  • Content-Type: application/json - Specifies that the request body format is JSON.

  • Accept: application/json - Indicates that the client expects a JSON response.

  • Authorization: Bearer {token} - A valid Bearer token must be provided to authenticate the request.

URL Parameters

  • companyId (integer, required): The id of the company (subscription) to query Location data. Inputting 0 will return location data for all companies accessible by your bearer token. Example: 0

Query Parameters:

  • page (Integer, Required): Specifies the page number in the pagination sequence to retrieve a specific set of results.

  • limit (Integer, Required): Specifies the number of records to retrieve per page, controlling the volume of data returned.

  • sortby (Integer, Required): Specifies the order the companies should be returned in:

    • 1 - Sort by Oldest Company ID

    • 2 - Sort by Newest Company ID

  • locationOrder (Integer, Required): Specifies the order the locations should be returned in:

    • 1 - Sort by Oldest Location ID

    • 2 - Sort by Newest Location ID

    • 3 - Sort Alphabetically by Location Name

    • 4 - Sort Reverse Alphabetically by Location Name

Request Examples

curl --request GET \
    --get "https://api.r1learning.com/api/v2/locations/0?page=1&limit=50&sortby=1&locationOrder=1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "Authorization: Bearer {token}"

Response

Meta:

Each List endpoint will contain a meta element which will describe the returned package. In this endpoint, the meta will provide the following information:

  • total_items (Integer): The number of locations returned

  • total pages (integer): The number of pages returned in the call to the endpoint. (Total Items / per_page limit)

  • current_page (integer): Indicates the current page number of the results

  • per_page (integer): Indicates the number of results (topics) that will be listed on a single page. The default is 50, the limit is 100.

Data Dictionary:

  • company_id (Integer): The unique identifier for the company within the R1 Discover system.

  • locations (object): The package of the specified company locations

    • id (integer): Unique identifier for each location.

    • location_name (string): Name of the facility or location.

    • status (string): The status of the location (published, pending, draft)

Response Examples

{
    "meta": {
        "total_items": 2,
        "total_pages": 1,
        "current_page": 1,
        "per_page": 50
    },
    "location_list": [
        {
            "company_id": 12345,
            "locations": [
                {
                    "id": 1273,
                    "location_name": "R1 Location 1",
                    "status": "published"
                },
                {
                    "id": 5692,
                    "location_name": "R1 Location 2",
                    "status": "published"
                }
            ]
        }
    ]
}
Link to the endpoint in Postman

Notes

  • Authorization Required: Ensure the provided Bearer token is valid and has sufficient privileges to access the endpoint.

  • Response Handling: Implement pagination to manage data effectively, especially when dealing with large datasets.

Last updated