The STRUCTURE service is used to extrapolate the structure of a table. In fact, the central data system can be queried, indicating a specific table, to obtain a list of all fields therein and the structure of each.

The service in question can be called up via the following URL: https://api.gooseapp.com/structure/


The JSON data structure must be sent by POST, below is an example of a call JSON:


{
code: "DEV001",
key: "09mpada9nx4mxl3346055518sf89hcyga74mwmhucgf9j7cg78",
table: "CON_TRO"
}


This call brings up a JSON containing all the fields found in the CON_TRO table.

The parameters available for the STRUCTURE calls are as follows.


Name


Type


Mandatory


Description


code


varchar(6)


Yes


Company code


key


varchar(200)


Yes


Secure API Key


table


varchar(7)


Yes


Table name



A call like the following allows you to obtain the information regarding the specific fields of the table in question.


{
 code: "DEV001",
 key: "09mpada9nx4mxl3346055518sf89hcyga74mwmhucgf9j7cg78",
 table: "CON_TRO"
}


If the operation performed is successful you will obtain the following JSON:


{
 status: "OK",
 result:
 {
  total: 71,
  data: 
  [
   {
    Field: "RECORD_ID",
    Type: "varchar(25)",
    Null: "NO",
    Key: "PRI",
    Default: "",
    Extra: ""
   },
   {
    Field: "CORAS",
    Type: "varchar(100)",
    Null: "YES",
    Key: "",
    Default: "",
    Extra: ""
   },

...

  ]
 }
} 


The "OK" status indicates that the STRUCTURE operation was successful. The result structure then contains the total (total selected rows) and data fields (return data structure).

If the operation performed is not successful you will obtain the following JSON:


{
 status: "error",
 error: 
 {
   code: 120,
   description: "Table 'client_goose_DEM001.CON_TRO' doesn't exist'"
 }
}



In case of an error, the status shows an "error" value and the error code and a description of the error are indicated in the error structure.


Do you want to ask us something?
Contact us at support@gooseapp.com