Create a TrustFeed
Endpoint que crea un TrustFeed (Los TrustFeed son tipos de mensaje para un channel). Recibe como parámetros los siguientes campos:
- company_id(obligatorio y válido)
- name(obligatorio)
Al registrar el TrustFeed, lo devuelve como respuesta.
Endpoint
Headers
Key | Value | Description |
---|---|---|
Content-Type | application/json | |
Authorization | Bearer {{access_token}} | access token obtained in Atenea |
Method: POST
URL: https://api.trust.lat/channels/v1/trust_feed
Body
{
"company_id": "9",
"name": "test"
}
caution
Recuerda que para utilizar este endpoint es necesario un access token obtenido en el servicio Atenea
Descripción de los campos
Key | Required | Data Type | Description |
---|---|---|---|
company_id | true | Integer | Id identificador de la compañia perteneciente al TrustFeed creado. Este campo debe ser válido para la creación |
name | true | String | Nombre del TrustFeed a crear |
Code Examples
- Curl
- JavaScript
- Python
curl --location --request POST 'https://api.trust.lat/channels/v1/trust_feed' \
--header 'Authorization: Bearer 4quUDNDn...' \
--header 'Content-Type: application/json' \
--data-raw '{
"company_id": "9",
"name": "test"
}'
import requests
url = "https://api.trust.lat/channels/v1/trust_feed"
payload="{\n\t\"company_id\": \"1\",\n\t\"name\": \"test\"\n}"
headers = {
'Authorization': 'Bearer 4quUDNDn...',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
var data = JSON.stringify({"company_id":"1","name":"test"});
var config = {
method: 'post',
url: 'https://api.trust.lat/channels/v1/trust_feed',
headers: {
'Authorization': 'Bearer 4quUDNDn...',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Responses
HTTP CODE: 201 CREATED
{
"code": 201,
"resource": "TrustFeed",
"data": {
"company_id": "9",
"created_at": "2020-09-15T05:08:10.213Z",
"name": "test",
"uuid": "9999-9999-99-999-999-99-99-99"
},
"message": "Created"
}
HTTP CODE: 422 Unprocessable Entity (name field blank)
{
"code": 422,
"resource": "Trust_feed",
"message": "Fail",
"errors": {
"name": [
"can't be blank"
]
}
}
HTTP CODE: 422 Unprocessable Entity (company_id field blank)
{
"code": 422,
"resource": "Trust_feed",
"message": "Fail",
"errors": {
"company_id": [
"can't be blank"
]
}
}