Create/Update Location (upsert)

An overview of the Create/Update Location Endpoint

Endpoint Description

This endpoint allows you to create or update a company location.

HTTP Method

POST /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

  • id (integer, required): The id of the company (subscription) to create or update Location data. Example: 1234

Query Parameters:

  • id (integer, optional): The id of the location to update. Leaving this field blank will create a new location under the specified company. Example: 1234

  • name (string, required): The name of the location. Example: Main Office

  • address1 (string, required): The primary address of the location. Example: 123 Main St

  • address2 (string, optional): The secondary address of the company. Example: Suite 456

  • city (string, required): The city where the locationis located. Example: New York

  • state (string, required): The state where the locationis located. Example: NY

  • zip (string, required): The zip code of the location. Example: 10001

  • country (string, required): The country code of the location. See List Countries global endpoint for country code list. Example: US

  • phone1 (string, optional): The primary phone number of the location. Example: 555-123-4567

  • email1 (string, required): The contact email for the location. Example: [email protected]

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

Request Examples

curl --request POST \
    "https://api.r1learning.com/api/v2/locations/1?location_name=Main+Office&address1=123+Main+St&address2=Apt+4B&city=New+York&state=NY&zip=10001&country=US&phone1=123-456-7890&email1=info%40company.com&status=published" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "Authorization: Bearer {token}"

Response

Data Dictionary:

  • id (Integer): The unique identifier for the location within the R1 Discover system.

  • name (string): The name of the location.

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

  • address1 (string): The address line of the location

  • address2 (string): The optional second address line for the location (Typically suite, unit, etc...)

  • city (string): The address city of the location

  • state (string): The address state of the location

  • zip (string): The address zip code of the location

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

  • phone1 (string): The primary phone number of the location.

  • email1 (string): The contact email for the location.

  • created_at (date): The creation date for the company location.

Response Examples

{
    "message": "Location created successfully",
    "data": {
        "id": 185672,
        "location_name": "Main Office",
        "company_item_id": "1234",
        "address1": "123 Main St",
        "address2": "Apt 4B",
        "city": "New York",
        "state": "NY",
        "zip": "10001",
        "country": "US",
        "phone1": "123-456-7890",
        "email1": "[email protected]",
        "created_at": "2024-09-14T03:47:35.000000Z",
        "updated_at": "2024-09-14T03:47:35.000000Z"
    }
}
Link to the endpoint in Postman

Notes

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

Last updated