Enviar Resposta da Pesquisa
Envia as respostas de uma pesquisa InApp (Sistemas Legados).
Pode ser chamado incrementalmente — enquanto o cliente responde pergunta a pergunta — e deve ser chamado com isFinalize=true na última chamada para marcar a pesquisa como concluída.
curl -X PUT "https://api.amplifique.me/partners/cf/inApp/61ddbce5b038c4c87c78b9b4?isFinalize=true" \
-H "Content-Type: application/json" \
-H "Authorization: YOUR_API_KEY" \
-d '{
"answers": [
{
"type": "nps",
"internal_name": "nps_1",
"answer": 10,
"isMainMetric": true
},
{
"type": "text",
"internal_name": "text_2",
"answer": "Ótimo atendimento"
}
]
}'
import requests
import json
url = "https://api.amplifique.me/partners/cf/inApp/61ddbce5b038c4c87c78b9b4?isFinalize=true"
headers = {
"Content-Type": "application/json",
"Authorization": "YOUR_API_KEY"
}
data = {
"answers": [
{
"type": "nps",
"internal_name": "nps_1",
"answer": 10,
"isMainMetric": true
},
{
"type": "text",
"internal_name": "text_2",
"answer": "Ótimo atendimento"
}
]
}
response = requests.put(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.amplifique.me/partners/cf/inApp/61ddbce5b038c4c87c78b9b4?isFinalize=true", {
method: "PUT",
headers: {
"Content-Type": "application/json",
"Authorization": "YOUR_API_KEY"
},
body: JSON.stringify({
"answers": [
{
"type": "nps",
"internal_name": "nps_1",
"answer": 10,
"isMainMetric": true
},
{
"type": "text",
"internal_name": "text_2",
"answer": "Ótimo atendimento"
}
]
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"answers": [
{
"type": "nps",
"internal_name": "nps_1",
"answer": 10,
"isMainMetric": true
},
{
"type": "text",
"internal_name": "text_2",
"answer": "Ótimo atendimento"
}
]
}`)
req, err := http.NewRequest("PUT", "https://api.amplifique.me/partners/cf/inApp/61ddbce5b038c4c87c78b9b4?isFinalize=true", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.amplifique.me/partners/cf/inApp/61ddbce5b038c4c87c78b9b4?isFinalize=true')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Put.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'YOUR_API_KEY'
request.body = '{
"answers": [
{
"type": "nps",
"internal_name": "nps_1",
"answer": 10,
"isMainMetric": true
},
{
"type": "text",
"internal_name": "text_2",
"answer": "Ótimo atendimento"
}
]
}'
response = http.request(request)
puts response.body
{
"_id": "61ddbce5b038c4c87c78b9b4",
"_survey": "60e336ef69a03a000e20164d",
"channel": 4,
"sent_at": "2022-01-11T17:22:45.150Z",
"opened_at": "2022-01-11T17:22:45.150Z",
"origin": "API",
"anonymized": false,
"_customer": "616ef4659ce878549d16c718",
"_business": "5b5765bec9498b0014883c0b",
"_smartTags": [
"example_string"
],
"billing_restriction": true,
"answers": [
{
"internal_name": "nps_1",
"answer": 3.14,
"isMainMetric": true,
"type": "nps",
"_id": "61e59e566176c3297d39b6f0"
}
],
"created_at": "2022-01-11T17:22:45.154Z",
"answered": true,
"answered_at": "2022-01-17T16:50:30.158Z",
"originIp": "::ffff:127.0.0.1",
"finalized": true,
"finalized_at": "2022-01-17T15:00:49.182Z"
}
/partners/cf/inApp/{id}Target server for requests. Edit to use your own host.
API key (sent in header)
ID do surveyAnswer retornado pelo endpoint Buscar Pesquisa InApp
Quando true, marca a pesquisa como finalizada. Enviar true na última chamada (quando o cliente completar todas as perguntas obrigatórias).
The media type of the request body
Array com as respostas das perguntas respondidas nesta chamada
Request Preview
Response
Response will appear here after sending the request
Authentication
API Key for authentication. Provide your API key in the header.
Path Parameters
ID do surveyAnswer retornado pelo endpoint Buscar Pesquisa InApp
Query Parameters
Quando true, marca a pesquisa como finalizada. Enviar true na última chamada (quando o cliente completar todas as perguntas obrigatórias).
Body
Array com as respostas das perguntas respondidas nesta chamada
Responses
ID da pesquisa-resposta
ID da pesquisa
Canal: 4 = InApp
Lista acumulada de respostas registradas até este momento
Se ao menos uma resposta foi registrada
Se a pesquisa foi marcada como finalizada (isFinalize=true)