Manuais
PHC GO Run Analysis
 

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": "2019-05-30T00:00:00Z"
},

{
"no": 2,
"name": "Data Final",
"value": "2020-06-30T00:00:00Z"
},

{
"no": 3,
"name": "Estado",
"value": "Vencida"
},

{
"no": 4,
"name": "Cliente",
"value": "Todos os Cliente"
},

{
"no": 5,
"name": "Ignora regularizações posteriores",
"value": "false"
},

{
"no": 6,
"name": "Mostra adiantamentos",
"value": "false"
}
]
}
}

 

Return Information


Any call made to this method will return a JSON information with this structure:

  1. 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
    }
    ]


  2. If the option value is “1”:


    {
    "code": 1,
    "message": "Analysis was exported with sucess.",
    "xlsx": "LINK FOR THE XLSX FILE"
    }


  3. In case of error:


    1. 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) }, ]"

    2. 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


     
    NameTypePHC GO EntityPHC GO FieldObservations
    optionInteger0 – 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


     
    NameTypePHC GO EntityPHC GO FieldObservations
    Id1Integer

     

    Variables2 (array of variables)


     
    NameTypePHC GO EntityPHC GO FieldObservations
    no1IntegerNumber of Variable
    name1StringName of variable
    Value1StringValue of Analysis Variable

     


    Footnotes


    1 - Required

    2 - Required if analysis require variables


    Example