Description
Use a HTTP POST request to create a Multi Request credential.
Request
HTTP Method: POST
Parameter | Description |
---|---|
name | Name of the credential. |
mode | Describes the type of credential (MULTI_REQUEST ) |
team_id | ID of Tines Team where the credential will be located. |
http_request_location_of_token | Location of token from response |
credential_requests | Details of the HTTP requests that are made to fetch the credential value. This should be an array of two objects, each with a required options key containing the JSON object representing the Agents::HTTPRequestAgent and an http_request_secret key, used to pass secrets to the options. The order of the objects in the array passed to credential_requests determines the order in which the requests will run. |
http_request_ttl | Optional Time to live (TTL) in seconds. Not sending this value during an update/PUT operation will update it to null. |
folder_id | Optional ID of folder to which the credential will be located |
read_access | Optional Control where this credential can be used (TEAM , GLOBAL , SPECIFIC_TEAMS ). default: TEAM . (SPECIFIC_TEAMS is a premium feature. Reach out to find out more.) |
shared_team_slugs | Optional List of teams' slugs where this credential can be used. Required to set read_access to SPECIFIC_TEAMS . default: [] (empty array). |
description | Optional Description of the credential. default: "" (empty string). |
metadata | Optional Key/value metadata relevant to the credential that can be referenced via the INFO path. |
allowed_hosts | Optional Array of domains where this credential can only be used in HTTP requests. Domain matching supports wildcards. |
live_credential_id | Optional ID of the live credential |
content_type | Optional Content type of the request payload. Configuration options |
Sample request
curl -X POST \
https://<<META.tenant.domain>>/api/v1/user_credentials \
-H 'content-type: application/json' \
-H 'Authorization: Bearer <<CREDENTIAL.tines_api_key>>' \
-d '{
"name": "multi request credential",
"mode": "MULTI_REQUEST",
"team_id": 2,
"http_request_location_of_token": "\\=credential_name.body.token",
"credential_requests": [
{
"options": {
"url": "http://www.example.com",
"content_type": "json",
"method": "post",
"payload": {
"key": "value",
"secret": "I can reference the \\<<secret>> as needed in the payload."
},
"headers": {}
},
"http_request_secret": "secret_value"
},
{
"options": {
"url": "http://www.example.com",
"content_type": "json",
"method": "post",
"payload": {
"key": "value",
"secret": "secret": "I can reference \\<<PREVIOUS_STEP>> or the \\<<secret>> as needed in the payload."
},
"headers": {}
},
"http_request_secret": "secret_value"
}
]
}'
Response
A successful request will return a JSON object describing the created credential.
Field description
Parameter | Description |
---|---|
id | credential ID. |
name | Name of the credential. |
mode | Describes the type of credential (TEXT, JWT, OAUTH, AWS, MTLS, HTTP_REQUEST_AGENT, MULTI_REQUEST ). |
team_id | ID of team to which the credential belongs. |
folder_id | ID of folder to which the credential belongs. |
read_access | Control where this credential can be used (TEAM , GLOBAL , SPECIFIC_TEAMS ). |
shared_team_slugs | List of teams' slugs where this credential can be used when read_access is SPECIFIC_TEAMS , otherwise empty. |
description | Description of the credential. |
slug | An underscored representation of the credential name |
created_at | ISO 8601 Timestamp representing date and time the credential was created. |
updated_at | ISO 8601 Timestamp representing date and time the credential was last updated. |
allowed_hosts | Array of domains where this credential can only be used in HTTP requests. |
metadata | Key/value metadata relevant to the credential |
test_credential_enabled | A boolean value stating if the credential is enabled for using a test credential |
test_credential | The test credential |
Sample response
{
"id": 1,
"name": "tines_api_credential",
"mode": "MULTI_REQUEST",
"team_id": 2,
"folder_id": 1,
"read_access": "TEAM",
"shared_team_slugs": [],
"slug": "tines_api_credential",
"created_at": "2021-03-26T12:34:16.540Z",
"updated_at": "2021-03-26T12:34:16.540Z",
"description": "",
"allowed_hosts": [],
"metadata": {},
"test_credential_enabled": false
}