Update a Callback Profile by ID
PATCH Method
Kaleyra.io offers an API that enables you to edit and update the callback profile details based on the ID.
Note:
PATCH Method allows passing in the API request only the attributes that need to be edited. All attributes not passed in the API request will retain their current value without any modification.
Base URL
<https://api.kaleyra.io>
To edit and update the callback profile detail based on ID, perform the following steps:
API request to edit and update the callback profile details
To edit and update the callback profile detail, use the /callback/profiles/<id>
endpoint with the following request method:
Request Format
curl --location --request PATCH '<url>/v1/<sid>/callback/profiles/<id>' \
--header 'api-key: <api-key>' \
--header 'Content-Type: <content-type>' \
--data-raw '{
"title":"<title>",
"http_method": "<http_method>",
"url": "<url>",
"body": "{<body>}",
"response_message": "<response_message>"
}'
The following table describes the parameter used for editing and updating callback profile details:
Parameter | Data Type | Description | Example | Mandatory |
---|---|---|---|---|
sid | String | Account SID (Security Identifier). | HXXXXXXX071IN | Yes |
id | String | Callback Profile ID (Security Identifier). | SG_bxxxxxxf-2xx4-4xx9-8xx7-fxxxxxxxxxxa | Yes |
api-key | String | API key generated from Kaleyra.io account. | Axxxxxxxxxxxxxxxxxxxxxxxxxxxx3 | Yes |
content-type | String | The format in which the data is sent. | application/json | Yes |
title | String | The Callback Profile name. Note: It should respect the following conditions: - Minimum three characters. - Only alphabet, numbers, spaces, hyphens, and underscores are allowed. | Callback_Profile_Test_2 | No |
http_method | String | The method type you want to use for the Callback Profile that you are updating. Allowed HTTP Methods are: - GET - POST - PUT - DELETE | POST | No |
url | String | The endpoint on which you want to receive a callback. It could be HTTP or HTTPS. | https://webhook.site/dxxxxxx9-bxx8-4xx2-9xx5-4xxxxxxxxxx8 | No |
body | Object | For POST and PUT methods, you need to provide the callback body. It should be in JSON format. The body is defined by the callback profile requester who is updating the callback profile. For example, the callback profile updated for the Default - No Channel Selected, Dynamic Variable is not defined by default, it has to configure based on the requirements. | {"name":""} | No |
response_message | String | The message you want to send to a requester when the Payload is successful. It is specific to chatbots and can be used only with chatbots. It may contain replacers. For example, when a request is made for Chatbot and if the payload is successful then you can update the message like, Thank you, {"name": "first_name"} and in response, it will be: Thank you, John, according to the database. | Profile updated successfully! | No |
Note:
At least you must pass one of the parameters listed to get a successful response.
Sample Request
The following is the sample request:
curl --location --request PATCH 'https://api.kaleyra.io/v1/HXXXXXXX071IN/callback/profiles/SG_bxxxxxxf-2xx4-4xx9-8xx7-fxxxxxxxxxxa' \
--header 'api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxx3' \
--header 'Content-Type: application/json' \
--data-raw '{
"title":"Callback_Profile_Test_1",
"http_method": "POST",
"url": "https://webhook.site/dxxxxxx9-bxx8-4xx2-9xx5-4xxxxxxxxxx8",
"body": "{"name":""}",
"response_message": "Profile updated successfully!"
}'
Sample Success Response
The following is the sample success response for editing and updating the callback profile details:
{
"code": "RBC024",
"message": "Profile updated successfully",
"data": {
"status": "Success",
"code": "KCLB2009",
"message": "Profile updated successfully",
"data": [
{
"profileId": "SG_bxxxxxxf-2xx4-4xx9-8xx7-fxxxxxxxxxxa"
}
]
},
"error": {},
"status": 200
}
Sample Failure Response
The following is a sample failure response:
{
"code": "RBC302",
"message": "Title already exists. Please provide a unique title",
"data": {},
"error": [
{
"body": "body/title and body/company_id must be unique"
}
],
"status": 400
}
For more information about response codes and statuses related to editing and updating callback profile details, see Response Codes and Statuses for Editing and Updating Callback Profile Details by ID.
Updated about 1 year ago