Create/Update Program (upsert)
An overview of the Create/Update Program endpoint.
Endpoint Description
This endpoint allows you to create or update a company location.
HTTP Method
POST /api/v2/programs/{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 Program data. Example: 1234
Query Parameters:
id (integer, optional): The id of the program to update. Leaving this field blank will create a new program under the specified company. Example: 1234
name (string, required): The name of the program. Example: New Program
parent_id (integer, required): The id of the program parent for alignment of the new/existing program. The id can be retrieved with the List Parent Programs endpoint. Example: 1234
status (string, required): The status of the program (published, pending, draft). Example: published
Request Examples
curl --request POST \
"https://api.r1learning.com/api/v2/programs/1?name=%22New+Program%22&parent_id=1&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 program within the R1 Discover system.
company_id (Integer): The unique identifier for the company within the R1 Discover system.
name (string): The name of the program.
program_parent_id (integer): The id of the program parent.
status (string): The status of the program (published, pending, draft)
created_at (date): The creation date for the company program.
updated_at (date): The date the company program was last updated.
Response Examples
{
"message": "The program \"New Program\" created successfully",
"data": {
"id": 18827,
"company_id": "1432",
"name": "New Program",
"parent_id": "2",
"status": "published",
"created_at": "2024-09-14T04:41:20.000000Z",
"updated_at": "2024-09-14T04:41:20.000000Z"
}
}
Postman Link
Notes
Authorization Required: Ensure the provided Bearer token is valid and has sufficient privileges to access the endpoint.
Last updated