Create Application
Este endpoint se encarga de crear una app perteneciente a una compañía. Esta aplicación tiene los siguientes campos:
Key | Required | Data Type | Example | Description |
---|---|---|---|---|
company_id | true | Integer | 1 | |
name | false | String | application_1 | |
description | false | String | application from test | |
bundle_id | true | String | com.trust.app_example | Identificador de la aplicación, es obligatorio que tenga el siguiente formato: com.your-company.app-name. |
flavor_id | true | String | com.trust.app_example | Actúa de forma similar al bundle_id pues actúa como un identificador, es por esta razón que se recomienda que tanto bundle y flavor sean el mismo (en caso de ser distintos se indicará que la aplicación es genérica). |
img | false | String | https://.../googlelogo.png | |
os | true | String | android | Debe ser 'android' o 'ios' |
generic_app | false | Boolean | false | |
img_circle | false | String | https://.../googlelogo.png | |
capabilities | true | Array | [] | |
client_uid | false | String | ||
colour | false | String |
Endpoint
Headers
Key | Value | Description |
---|---|---|
Content-Type | application/json | |
Authorization | Bearer {{access_token}} | access_token obtained in Atenea |
Url
Method: POST
URL: https://api.trust.lat/company/api/v2/app
Body
{
"company_id": 1,
"name": "application_1",
"description": "application from test 1",
"bundle_id": "com.trust.application",
"flavor_id": "com.trust.application",
"img": "https: //picsum.photos/200/300",
"os": "android",
"generic_app": false,
"img_circle":"",
"capabilities":[],
"client_uid":"",
"colour":""
}
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 POST 'https://api.trust.lat/company/api/v2/app' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data-raw '{
"company_id": 1,
"name": "application_1",
"description": "application from test 1",
"bundle_id": "com.trust.application",
"flavor_id": "com.trust.application",
"img": "https: //picsum.photos/200/300",
"os": "android",
"generic_app": false,
"img_circle":"",
"capabilities":[],
"client_uid":"",
"colour":""
}'
import requests
url = "https://api.trust.lat/company/api/v2/app"
payload="{\n \"company_id\": 1,\n \"name\": \"application_1\",\n \"description\": \"application from test 1\",\n \"bundle_id\": \"com.trust.application\",\n \"flavor_id\": \"com.trust.application\",\n \"img\": \"https://google.cl\",\n \"os\": \"android\",\n \"generic_app\": false,\n \"img_circle\":\"\",\n \"capabilities\":[],\n \"client_uid\":\"\",\n \"colour\":\"\"\n}"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer {{accessToken}}'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
var data = JSON.stringify({"company_id":1,"name":"application_1","description":"application from test 1","bundle_id":"com.trust.application","flavor_id":"com.trust.application","img":"https://google.cl","os":"android","generic_app":false,"img_circle":"","capabilities":[],"client_uid":"","colour":""});
var config = {
method: 'post',
url: 'https://api.trust.lat/company/api/v2/app',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer {{accessToken}}'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Responses
HTTP Code: 201 Created
{
"status": true,
"message": "The app was created.",
"app": {
"id": 1,
"bundle_id": "com.trust.application_example",
"company_id": 1,
"name": "application_1",
"description": "application from test 1",
"created_at": "2021-07-09T16:48:12.828Z",
"updated_at": "2021-07-09T16:48:12.828Z",
"status": true,
"img": "https://picsum.photos/200/300",
"capabilities": [],
"flavor_id": "com.trust.application",
"os": "android",
"client_uid": "",
"img_circle": "",
"generic_app": false,
"colour": ""
}
}
HTTP Code: 404 Not Found - Bundle already exists
{
"status": false,
"message": "Bundle already exists."
}
HTTP Code: 404 Not Found - Company Not Found
{
"status": false,
"message": "Company not found."
}
HTTP Code: 422 Unprocessable Entity - Without company_id
{
"status": false,
"message": "Insufficient parameters."
}