API V2 Import Measures values

Hi all.

I was using the API V1 to retrieve the values of the import measures.
Previously was possible to find an array with the import measures where inside each node I could get the data like ‘effective_end_date’, ‘vat’, ‘measure_type’, ‘measure_type->id’ and more important the duty_expression.

Now on the V2 I just have an Id and a type. Seams logic to get the data from the referred unit but I didn’t find any endpoint on the documentation to retrieve this.

So I’d like to know where to find the values of Duty and Vat using the V2 of the API.

Thank you

Rodrigo

Rodrigo,

The same information is in V2, just organized differently.

V2 is using jsonapi-style responses on V2, and all the same information in V1 is there, just organised differently.

E.g.: for each commodity, all the ids of all the import_measures for that commodity are in the data.relationships.import_measures node. These are the ones with the id and type attributes only.

The :id from any particular measure is then used to “look-up” the actual measure object that’s in the included node.

To find a particular measure:

  1. locate the id and type of the measure in data.relationships
  2. using id and type from the previous step, locate the measure and all it’s information in included

Note that the nodes in included may also have their own data.relationships objects. For example, the measure’s data.relationships is where you’ll find the measure’s duty_expression'. So you would repeat the process of finding the id and type, then using them to locate that object in included.

The V2 response has the format described below.

{
  data: {
    relationships: [{
      "import_measures": {
        "data": [{
          "id": "-533605",
          "type": "measure"
        }]
    }]
    included: [
      {
        "id": "-533605",
        "type": "measure",
        "attributes": {
          "id": -533605,
          "origin": "uk",
          "effective_start_date": "2019-08-01T00:00:00.000Z",
          "effective_end_date": null,
          "import": true,
          "excise": false,
          "vat": true
        },
        "relationships": {
          "duty_expression": {
            "data": {
              "id": "-533605-duty_expression",
              "type": "duty_expression"
          }
        },
    ...other stuff...
}