Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

...

Section


Column
width30%

Retrieving the database structure of a register

To generate the various end-points Burti API relies on the database structure that Standard ERP exposes via the Export/import Format report in its' Technics module.

When the report is run without specifying a register code, it will dump the database definitions of all the registers in the database. These are for example Invoices, Sales Orders, Deliveries and such.

You will need to look up the register(-s) that you wish to expose via the API in this report and then separately export these to a text file.

Example

In this example we show how to retrieve the database structure of the Orders register to use for creating its' API end-point.

Step 1: Enter the keyword "Orders" in the search field of the report

Step 2: Cycling through the search results pin-point the correct register and take note of its' code (ORVc).

Step 3: Reopen to the Report Specification window using the cogwheel menu available in the upper-left hand corner of the window.

Step 4: Enter the register code (ORVc in this example) in the field labeled "Vc (View Code)", set Media to File and press Run to save the definition in a file.


Column
width70%


...

Section


Column
width60%

Documentation

ParameterUsage

token

(warning) without request number prefix

Must be included, if you've set up a security token in your API Settings.

query 

This routes the API to the specific register's end-point. This is supplied in the following format:

Code Block
Web_JSON_<register-code>_List.hal

So for example for the Orders register with code ORVc the end-point becomes Web_JSON_ORVc_List.hal 

company The company number from which you wish to the data to be retrieved.

full 

(optional)

Set this to true  to retrieve the full data set (as defined using the "In full" column in the API Register Definition record as described earlier).

Defaults to false 

count 

(optional)

The number of records to return.

Defaults to 50 

offset 

(optional)

Used together with the count  paramete to skip the first set of records when employing a paginated record retrieval approach (i.e. offset of 50 with count of 50 would mimic requesting a second page of 50 records).
since_seq 

(optional)

All data sets for registers that support sequencing/sequence numbers are returned along with the current database sequence number - a counter that is increased when a change is made in the respective register. If you record this number and then use it as the since_seq  parameter in subsequent calls, you can retrieve only the records that have changed since the previous data request.
index 

(optional)

Select the index you wish your data to be sorted by or looked up by. Must be defined in the API Register Definition.

Defaults to the main key specified on the API Register Definition.

sort_only 

(optional)

If you do not wish to lookup data by specific values of the fields in the specified index, you can set this to true to only apply a sort by this index.

Defaults to false 

sort_order 

(optional)

Set to back to apply a descending sort order.

Defaults to forward 

fieldcnt 

(optional)

When looking up data by specific index field values, you must specify the index segment/field count to use.

Defaults to none 

fieldlist 

(optional)

When looking up data by specific index field values, you must specify the field names by which to perform the lookup.

This is then accompanied with additional dynamic fieldname-named parameters.

Example: index=CustCode&fieldcnt=1&fieldlist=CustCode&CustCode=05131 

Note

This is a pseudo-example, as you always have to prepend the parameter names with the request's index. In single-request calls use 0  (0_index and so on).


Info

When using indexes with date fields for lookups you can either lookup by a single specific date or use a date range. To use a lookup by range, add another parameter along with the date field, with the string "-until" appended.

Example: When using field OrderDate you can use either just the OrderDate=2020-01-01  for a single date or both OrderDate=2020-01-01  and OrderDate-until=2020-01-31 for a full month.

You do not need to list the -until  parameter in fieldlist 

Date format is YYYY-MM-DD  everywhere on the API.


new 

(optional)

This parameter will return a blank record to be used as a template for populating a new record.

debug 

(optional)

Set this to on to enable debug logging in hansa.log  for each API call. This will give performance statistics of the call.

Default value is off 

paramlist 

(optional)

Use this to list parameter names that you wish to see the values of dumped to the debug information log.

any fieldname

(optional)

You can pass any field name with a value to use as a filter. For example, you could use the Order field InvFlag  value set to 0, to only filter Orders that need to be invoiced.

Note

You need to explicitly configure the fields you wish to filter by in this manner by setting the matrix column Filter by to "Include" in the API definition record.




Column
width40%

Examples

Code Block
languagebash
titleSimple record list retrieval using curl
linenumberstrue
curl "https://your.server.address/Web_JSON_Composer.hal \
  ?token=security_token
  &0_query=Web_JSON_ORVc_List.hal
  &0_company=1
  &0_count=5"


Code Block
languagejs
titleResult
linenumberstrue
collapsetrue
{
  "0": {
    "addinfo": {},
    "db-seq-nr": 1082107131,
    "records": [
      {
        "SerNr": 200000,
        "OrdDate": "2019-12-04",
        "CustCode": "02306",
        "Addr0": "Smith and Sons"
      },
.. 5 records in total ..
    ]
  }
}


Info

You will notice that the result is also returned in numbered blocks to match your query request index(-es).

-

Code Block
languagebash
titleSimple record list retrieval using curl, also demonstrating the use of multiple requests in one call
linenumberstrue
curl "https://your.server.address/Web_JSON_Composer.hal \
  ?token=security_token
  &0_query=Web_JSON_ORVc_List.hal
  &0_company=1
  &0_index=SerNr
  &0_fieldlist=SerNr
  &0_fieldcnt=1
  &0_SerNr=200000
  &1_query=Web_JSON_ORVc_List.hal
  &1_company=1
  &1_index=SerNr
  &1_fieldlist=SerNr
  &1_fieldcnt=1
  &1_SerNr=200001"


Code Block
languagejs
titleResult
linenumberstrue
collapsetrue
{
  "0": {
    "addinfo": {},
    "db-seq-nr": 1082107131,
    "records": [
      {
        "SerNr": 200000,
        "OrdDate": "2019-12-04",
        "CustCode": "02306",
        "Addr0": "Smith and Sons"
      }
    ]
  },
  "1": {
    "addinfo": {},
    "db-seq-nr": 1082107131,
    "records": [
      {
        "SerNr": 200001,
        "OrdDate": "2019-12-04",
        "CustCode": "02921",
        "Addr0": "Only Smith's Sons"
      }
    ]
  }

}

-

Code Block
languagebash
titleRetrieving a full record
linenumberstrue
curl "https://your.server.address/Web_JSON_Composer.hal \
  ?token=security_token
  &0_query=Web_JSON_ORVc_List.hal
  &0_company=1
  &0_full=true
  &0_index=SerNr
  &0_fieldlist=SerNr
  &0_fieldcnt=1
  &0_SerNr=200000"


Code Block
languagejs
titleResult
linenumberstrue
collapsetrue
{
  "0": {
    "addinfo": {},
    "db-seq-nr": 1082107131,
    "records": [
      {
        "SerNr": 200000,
        "OrdDate": "2019-12-04",
        "CustCode": "02306",
        "Addr0": "Smith and Sons",
        "Addr1": "13 Grange Road",
        "Addr2": "",
        "Addr3": "Bermondsey",
        "OurContact": "",
        "CustContact": "Miss Yolanda Sweet",
        "ExportFlag": 0,
        "InvFlag": 2,
        "ShipFlag": 1,
        "Prntdf": 1,
        "PayDeal": "30",
        "CustCat": "VIP",
        "InvMark": true,
        "ShipMark": true,
        "Objects": ["Z413", "D02306", "VIP"],
        "ShipMode": "",
        "OrderStatus": 0,
        "SalesMan": ["SJ"],
        "Sign": "",
        "ShipDeal": "",
        "ShipAddr0": "",
        "ShipAddr1": "",
        "ShipAddr2": "",
        "ShipAddr3": "",
        "CurncyCode": "GBP",
.. other defined fields ..
        "$matrix": [
          {
            "stp": 1,
            "ArtCode": "ITEM1",
            "Quant": 1,
            "Price": 19,
            "Sum": 19,
            "vRebate": 0,
            "SalesAcc": "4010",
            "Shipd1": 1,
            "Shipd2": 1,
            "Invd": 1,
            "Objects": ["SGR", "TPB", "ORI"],
            "BasePrice": 16.13,
            "rowGP": 2.87,
            "Spec": "Main Item With Interesting Example Name",
            "VATCode": "0",
.. other row fields ..
          },
          {
            "stp": 1,
            "ArtCode": "ITEM1",
            "Quant": 1,
            "Price": 19,
            "Sum": 19,
            "vRebate": 0,
            "SalesAcc": "4010",
            "Shipd1": 1,
            "Shipd2": 1,
            "Invd": 1,
            "Objects": ["SGR", "TPB", "ORI"],
            "BasePrice": 16.13,
            "rowGP": 2.87,
            "Spec": "Main Item With Interesting Example Name",
            "VATCode": "0",
.. other row fields ..
          },
          {
            "stp": 1,
            "ArtCode": "ITEM1",
            "Quant": 1,
            "Price": 19,
            "Sum": 19,
            "vRebate": 0,
            "SalesAcc": "4010",
            "Shipd1": 1,
            "Shipd2": 1,
            "Invd": 1,
            "Objects": ["SGR", "TPB", "ORI"],
            "BasePrice": 16.13,
            "rowGP": 2.87,
            "Spec": "Main Item With Interesting Example Name",
            "VATCode": "0",
.. other row fields ..
          }
        ]
      }
    ]
  }
}



...

Section


Column
width50%

Read API

Functions are available in the register's Read interface's Tools file as previously mentioned.

FunctionUsage

AddInfoGeneral 

Allows to add any additional information in the response JSON. This will appear as the contents of the response block's addinfo JSON property

Options 

Allows to set specific options for this request block (e.g. things like JSON formatting options)

AddInfoRec 

Allows to add any additional information in the response JSON of specific records. This will appear as sibling data to the record's fields. If you wish to separate, you need to explicitly make a wrapping property.

AddInfoRow 

Allows to add any additional information in the response JSON of specific records rows. This will appear as sibling data to the row's fields. If you wish to separate, you need to explicitly make a wrapping property.

LoopTest 

Allows to add additional test conditions for record loops, that are more complex that checking agains a single value of a field

LoginTest 

Allows to add authentication logic that's specific to a register's API

NewExtra 

Allows to add extra information when retrieving a blank record template with the new parameter.



Column
width50%

Write API

Functions are available in the register's Write interface's Tools file as previously mentioned.

FunctionUsage

SaveCheck 

 

Allows to add RecordCheck-like validations or even a full RecordCheck call

DeleteCheck 

 

Allows to add custom logic for validation record deletion

SaveWarnings 

 

Add custom warnings that do not fail the storing of record, but simply provide some warning-level feedback

SaveExtra 

 

Allows to perform additional actions when storing records

DownloadFileTest 

 

Allows to implement custom logic when determining whether attachment download is allowed for a record

UploadFileTest 

 

Allows to implement custom logic when determining whether attachment upload is allowed for a record

RemoveFileTest 

 

Allows to implement custom logic when determining whether attachment removal is allowed for a record

PasteValue 

Can add actions that should be run after setting a value for each or separate fields. This is similar to AfterEditField Window Actions



...