Read Campaigns using Company ID
Endpoint diseñado para buscar las campañas por bajo la identificación de un company ingresado. Este endpoint contiene filtros por lo que es posible realizar una búsqueda personalizada que puede ser por los siguientes parámetros:
Campo Búsqueda | Descripción | Ejemplo |
---|---|---|
fields | Campos que se desean ser retornados al hacer la búsqueda. | company_id, total, name, terminated |
terminated | Campo para filtrar campañas según su estado (true si la campaña terminó o false en caso de estar activa aún). | true |
search | Busca un texto ingresado en los campos uuid y name | Dialogo Cuida postur |
Endpoint
Headers
Key | Value | Description |
---|---|---|
Content-Type | application/json | |
Authorization | Bearer {{access_token}} | access_token obtained in Atenea |
Endpoint:
Method: GET
Type:
URL: https://api.trust.lat/campaigns/api/v1/company/:company_id/campaign
caution
Recuerda que para utilizar este endpoint es necesario un access token obtenido en el servicio Atenea
Code Examples
- Curl
- JavaScript
- Python
curl --location --request GET 'https://api.trust.lat/campaigns/api/v1/company/1/campaign' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Bearer {{accessToken}}'
import requests
url = "https://api.trust.lat/campaigns/api/v1/company/1/campaign"
payload={}
headers = {
'Content-Type': 'text/plain',
'Authorization': 'Bearer {{accessToken}}'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
var config = {
method: 'get',
url: 'https://api.trust.lat/campaigns/api/v1/company/1/campaign',
headers: {
'Content-Type': 'text/plain',
'Authorization': 'Bearer {{accessToken}}'
}
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Responses
HTTP Code: 200 OK - Found
{
"code": 200,
"resource": "Campaign",
"data": [
{
"app_id": "1",
"application_name": "com.bundle_id.application",
"company_id": "1",
"created_at": "2021-07-02T20:51:53.950Z",
"finish_date": null,
"flavor_id": "com.bundle_id.application",
"message_id": "z54afc5-a1c0-1b0a-9f04-acacd3b473a",
"name": "totam-officiis-aliquid:141",
"segment_id": "",
"terminated": true,
"updated_at": "2021-07-02T20:52:39.367Z",
"uuid": "zerbf63c-ef51-4623-a5c3-e38eff32cb48"
},
{
"app_id": "1",
"application_name": "com.bundle_id.application2",
"company_id": "1",
"created_at": "2021-07-01T21:14:44.453Z",
"finish_date": null,
"flavor_id": "com.bundle_id.application2",
"message_id": "zc5b86d1-6815-4989-995a-a6317zxc093",
"name": "Campaña: deep link dialog",
"segment_id": "",
"terminated": true,
"updated_at": "2021-07-02T02:00:00.383Z",
"uuid": "zdbf23a6-6b72-4bc5-876e-518e478436d6"
}
],
"message": "Found",
"page": 1,
"per_page": 5,
"total": 446
}
HTTP Code: 200 Found with rules - Search option
El campo search fue rellenado previamente por el texto Dialogo Cuida postur.
{
"code": 200,
"resource": "Campaign",
"data": [
{
"app_id": "1",
"application_name": "com.bundle_id.application",
"company_id": "1",
"created_at": "2021-04-22T19:56:32.900Z",
"finish_date": null,
"flavor_id": "com.bundle_id.application",
"message_id": "cdf078e0-24c6-479b-8db1-bb69dec8fe2f",
"name": "Campaña: Dialogo Cuida postur",
"segment_id": "",
"terminated": true,
"updated_at": "2021-04-22T20:00:02.420Z",
"uuid": "f8369570-00b2-4952-b9ca-91531fb36b35"
},
{
"app_id": "1",
"application_name": "com.bundle_id.application2",
"company_id": "1",
"created_at": "2021-06-11T01:04:20.575Z",
"finish_date": null,
"flavor_id": "com.bundle_id.application",
"message_id": "zf561e0-2zc6-47b-8db1-bb69dec8fe2f",
"name": "Campaña: Dialogo Cuida postur",
"segment_id": "",
"terminated": true,
"updated_at": "2021-06-11T02:00:02.838Z",
"uuid": "z2fc5d65-5c85-423e-a162-as1afafe06cf"
}
],
"message": "Found",
"page": 1,
"per_page": 5
}
HTTP Code: 200 No Data
{
"code": 200,
"resource": "Campaign",
"data": [],
"message": "Found",
"page": 1,
"per_page": 5,
"total": 0
}