Update a structured data field
curl --request PUT \
--url https://api.sandbox.asapp.com/configuration/v1/structured-data-fields/{structuredDataFieldId} \
--header 'Content-Type: application/json' \
--header 'asapp-api-id: <api-key>' \
--header 'asapp-api-secret: <api-key>' \
--data '
{
"name": "Promotion was offered",
"categoryId": "OUTCOME",
"type": "QUESTION",
"question": {
"question": "Did the agent offer the correct promotion?"
},
"active": true
}
'import requests
url = "https://api.sandbox.asapp.com/configuration/v1/structured-data-fields/{structuredDataFieldId}"
payload = {
"name": "Promotion was offered",
"categoryId": "OUTCOME",
"type": "QUESTION",
"question": { "question": "Did the agent offer the correct promotion?" },
"active": True
}
headers = {
"asapp-api-id": "<api-key>",
"asapp-api-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'asapp-api-id': '<api-key>',
'asapp-api-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Promotion was offered',
categoryId: 'OUTCOME',
type: 'QUESTION',
question: {question: 'Did the agent offer the correct promotion?'},
active: true
})
};
fetch('https://api.sandbox.asapp.com/configuration/v1/structured-data-fields/{structuredDataFieldId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.asapp.com/configuration/v1/structured-data-fields/{structuredDataFieldId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Promotion was offered',
'categoryId' => 'OUTCOME',
'type' => 'QUESTION',
'question' => [
'question' => 'Did the agent offer the correct promotion?'
],
'active' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"asapp-api-id: <api-key>",
"asapp-api-secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.asapp.com/configuration/v1/structured-data-fields/{structuredDataFieldId}"
payload := strings.NewReader("{\n \"name\": \"Promotion was offered\",\n \"categoryId\": \"OUTCOME\",\n \"type\": \"QUESTION\",\n \"question\": {\n \"question\": \"Did the agent offer the correct promotion?\"\n },\n \"active\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("asapp-api-id", "<api-key>")
req.Header.Add("asapp-api-secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.sandbox.asapp.com/configuration/v1/structured-data-fields/{structuredDataFieldId}")
.header("asapp-api-id", "<api-key>")
.header("asapp-api-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Promotion was offered\",\n \"categoryId\": \"OUTCOME\",\n \"type\": \"QUESTION\",\n \"question\": {\n \"question\": \"Did the agent offer the correct promotion?\"\n },\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.asapp.com/configuration/v1/structured-data-fields/{structuredDataFieldId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["asapp-api-id"] = '<api-key>'
request["asapp-api-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Promotion was offered\",\n \"categoryId\": \"OUTCOME\",\n \"type\": \"QUESTION\",\n \"question\": {\n \"question\": \"Did the agent offer the correct promotion?\"\n },\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "q_promotion_was_offered",
"name": "Promotion was offered",
"categoryId": "OUTCOME",
"type": "QUESTION",
"question": {
"question": "Did the agent offer the correct promotion?"
},
"active": true
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "400-01",
"message": "Bad request"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "401-01",
"message": "Unauthorized"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "403-01",
"message": "Forbidden Response"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "404-01",
"message": "Not Found"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "409-01",
"message": "Conflict"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "413-01",
"message": "Request Entity Too Large"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "422-01",
"message": "Unprocessable Entity"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "429-01",
"message": "Too Many Requests"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "500-01",
"message": "Internal server error"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "503-01",
"message": "Service Unavailable"
}
}Structured Data Fields
Update a structured data field
Update a specific structured data field specifying the id
PUT
/
configuration
/
v1
/
structured-data-fields
/
{structuredDataFieldId}
Update a structured data field
curl --request PUT \
--url https://api.sandbox.asapp.com/configuration/v1/structured-data-fields/{structuredDataFieldId} \
--header 'Content-Type: application/json' \
--header 'asapp-api-id: <api-key>' \
--header 'asapp-api-secret: <api-key>' \
--data '
{
"name": "Promotion was offered",
"categoryId": "OUTCOME",
"type": "QUESTION",
"question": {
"question": "Did the agent offer the correct promotion?"
},
"active": true
}
'import requests
url = "https://api.sandbox.asapp.com/configuration/v1/structured-data-fields/{structuredDataFieldId}"
payload = {
"name": "Promotion was offered",
"categoryId": "OUTCOME",
"type": "QUESTION",
"question": { "question": "Did the agent offer the correct promotion?" },
"active": True
}
headers = {
"asapp-api-id": "<api-key>",
"asapp-api-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'asapp-api-id': '<api-key>',
'asapp-api-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Promotion was offered',
categoryId: 'OUTCOME',
type: 'QUESTION',
question: {question: 'Did the agent offer the correct promotion?'},
active: true
})
};
fetch('https://api.sandbox.asapp.com/configuration/v1/structured-data-fields/{structuredDataFieldId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.asapp.com/configuration/v1/structured-data-fields/{structuredDataFieldId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Promotion was offered',
'categoryId' => 'OUTCOME',
'type' => 'QUESTION',
'question' => [
'question' => 'Did the agent offer the correct promotion?'
],
'active' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"asapp-api-id: <api-key>",
"asapp-api-secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.asapp.com/configuration/v1/structured-data-fields/{structuredDataFieldId}"
payload := strings.NewReader("{\n \"name\": \"Promotion was offered\",\n \"categoryId\": \"OUTCOME\",\n \"type\": \"QUESTION\",\n \"question\": {\n \"question\": \"Did the agent offer the correct promotion?\"\n },\n \"active\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("asapp-api-id", "<api-key>")
req.Header.Add("asapp-api-secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.sandbox.asapp.com/configuration/v1/structured-data-fields/{structuredDataFieldId}")
.header("asapp-api-id", "<api-key>")
.header("asapp-api-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Promotion was offered\",\n \"categoryId\": \"OUTCOME\",\n \"type\": \"QUESTION\",\n \"question\": {\n \"question\": \"Did the agent offer the correct promotion?\"\n },\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.asapp.com/configuration/v1/structured-data-fields/{structuredDataFieldId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["asapp-api-id"] = '<api-key>'
request["asapp-api-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Promotion was offered\",\n \"categoryId\": \"OUTCOME\",\n \"type\": \"QUESTION\",\n \"question\": {\n \"question\": \"Did the agent offer the correct promotion?\"\n },\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "q_promotion_was_offered",
"name": "Promotion was offered",
"categoryId": "OUTCOME",
"type": "QUESTION",
"question": {
"question": "Did the agent offer the correct promotion?"
},
"active": true
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "400-01",
"message": "Bad request"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "401-01",
"message": "Unauthorized"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "403-01",
"message": "Forbidden Response"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "404-01",
"message": "Not Found"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "409-01",
"message": "Conflict"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "413-01",
"message": "Request Entity Too Large"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "422-01",
"message": "Unprocessable Entity"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "429-01",
"message": "Too Many Requests"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "500-01",
"message": "Internal server error"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "503-01",
"message": "Service Unavailable"
}
}Body
application/json
- Option 1
- Option 2
Update a structured data field
Response
Successfully updated the structured data field.
- Question
- Entity
Was this page helpful?