Update Environment Variable
Use this API to update an existing Hook Environment Variable and define its value.
When an Environment Variable is updated, all of the functions that are using that variable will also be updated to get the new value.
For more detail on how to use environment variables within a hook function see the Smart Hooks Overview.
Resource URL
https://<subdomain>/api/2/hooks/envs/:id
Header Parameters
Authorization required string | Set to Set The access token must have been generated using an API credential pair created using the scope required to call this API. This API can be called using any one of the following scopes: In order to use Smart Hooks your API Credentials must be created after 21st October 2020. |
Content-Type required string |
Set to application/json . |
Resource Parameter
id required string |
Set to the |
Request Parameters
value required string |
The secret value that will be encrypted at rest and injected in applicable hook functions at run time. |
Sample Responses
- 200 Ok
- 400 Bad Request
- 401 Unauthorized
- 422 Unprocessable Entity
{
"id": "80f65e4b-4325-4ee6-86af-9e6b8793f125",
"name": "SAMPLE_VAR",
"created_at": "2020-10-22T22:07:48.236Z",
"updated_at": "2020-10-22T22:09:12.307Z"
}
{
"name": "BadRequestError",
"message": "Invalid env record ID"
}
Typically, this error means that your Authorization
header value is missing or incorrectly formatted. The Authorization
header value should use this format: bearer:<access_token>
.
{
"name": "UnauthorizedError",
"message": "The request requires user authentication."
}
The name of a var can not be changed
{
"name": "UnprocessableEntityError",
"message": "instance additionalProperty \"name\" exists in instance when not allowed"
}
Postman Collection
- Clicking Run in Postman button navigates to the page where you can fork the collection to your workspace. Forking the collection into your workspace will enable you to contribute to the source collection using pull requests. You can also view the collection in a public workspace if you like and even import a copy of the collection using the links present on the screen.
Sample Code
cURL
Replace sample values indicated by < >
with your actual values.
Update Hook Environment Variable
curl 'https://<subdomain>/api/2/hooks/envs/:id' \
-X PUT \
-H "Authorization: bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{
"value": "helloworld"
}'
Have a Question?
Found a problem or a bug? Submit a support ticket.
Looking for walkthroughs or how-to guides on OneLogin's user and admin features? Check out the documentation in our Knowledge Base.
Have a product idea or request? Share it with us in our Ideas Portal.