Method
The method to be called is:
Parameters
In the request headers the Authorization header must have the Access Token:
- Authorization: {{accessToken}}
JSON body
In the body of the POST a JSON structure like this one has to be passed:
Note: The following example is an analysis with variables
{
"requestOptions": {
"option":0
},
"analysis": {
"id": 261,
"variables": [
{
"no": 1,
"name": "Data Inicial",
"value": "2024-01-01T00:00:00Z"
},
{
"no": 2,
"name": "Data Final",
"value": "2024-12-31T00:00:00Z"
},
{
"no": 3,
"name": "Estado",
"value": "Vencida"
},
{
"no": 4,
"name": "Cliente",
"value": "Todos os Cliente"
},
{
"no": 5,
"name": "Mostra documentos já regularizados",
"value": false
},
{
"no": 7,
"name": "Mostra adiantamentos",
"value": false
}
{
"no": 8,
"name": "Deduz retenções",
"value": false
},
{
"no": 9,
"name": "Excluir movimentos incobráveis",
"value": false
},
]
}
}
Return Information
Any call made to this method will return a JSON information with this structure:
-
If the option value is “0”:
It returns the data of the analysis, for example:
{
"stamp": "b66-425b-b0d2-a321bd61fab",
"nome": "A Música na Moda",
"documento": "N/Fatura 8",
"data": "2020.06.09",
"dataven": "2020.08.10",
"original": 2955.69,
"saldo": 2955.69,
"dias": 236,
"targ": "1",
"revisionNumber": 0
}
]
-
If the option value is “1”:
{
"code": 1,
"message": "Analysis was exported with sucess.",
"xlsx": "LINK FOR THE XLSX FILE"
}
-
In case of error:
- In this case, that analysis require variables (assuming that developer did not pass them to method) The API suggest the correct “variables” structure for the analysis:
{
"code": 100,
"message": "Missing parameter variables with this : [{ no: 1, nome: Data Inicial, value: (Date like this - 2020-03-03 23:00:00) }, { no: 2, nome: Data final, value: (Date like this - 2020-03-01 23:00:00) }, { no: 3, nome: Estado, value: (One of this itens - Todos,Vencida,Por Vencer,Próprio Dia) }, ]"
- If analysis doesn’t require variables, In the body of the POST a JSON structure like this one has to be passed:
{
"analysis": {
"id": 558
}
}
JSON Specification for Run Analysis
Request Options
Name | Type | PHC GO Entity | PHC GO Field | Observations |
option | Integer | – | – | 0 – Return the analysis values as JSON
1 – Return the analysis as XLSX file
(If no option is specified the default option will be 0) |
Analysis
Name | Type | PHC GO Entity | PHC GO Field | Observations |
Id1 | Integer | – | – | |
Variables2 (array of variables)
Name | Type | PHC GO Entity | PHC GO Field | Observations |
no1 | Integer | – | – | Number of Variable |
name1 | String | – | – | Name of variable |
Value1 | String | – | – | Value of Analysis Variable |
Footnotes
1 - Required
2 - Required if analysis require variables