ONE-Record icon indicating copy to clipboard operation
ONE-Record copied to clipboard

[API] How to PATCH properties like Item.dimensions.volume.value?

Open grichka opened this issue 4 years ago • 4 comments

ONE Record API standard includes specification of PATCH for "ownned" properties, inspired from json-ld-patch.

For example, here is the body of a PATCH request aiming to modify the value of Item.lotNumber:

{
  "@type": ["https://onerecord.iata.org/api/PatchRequest"],
  "https://onerecord.iata.org/api/PatchRequest#description": "Change company prefix",
  "https://onerecord.iata.org/api/PatchRequest#logisticsObjectRef": {
    "@type": ["https://onerecord.iata.org/api/LogisticsObjectRef"],
    "https://onerecord.iata.org/api/LogisticsObjectRef#logisticsObjectId": "http://uri/companies/companyId/items/1"
  },
  "https://onerecord.iata.org/api/PatchRequest#operations": [
    {
      "@type": ["https://onerecord.iata.org/api/Operation"],
      "https://onerecord.iata.org/api/Operation#o": {
        "@type": ["https://onerecord.iata.org/api/OperationObject"],
        "https://onerecord.iata.org/api/OperationObject#datatype": "https://www.w3.org/2001/XMLSchema#string",
        "https://onerecord.iata.org/api/OperationObject#value": "1"
      },
      "https://onerecord.iata.org/api/Operation#op": "del",
      "https://onerecord.iata.org/api/Operation#p": "https://onerecord.iata.org/cargo/Item#lotNumber"
    },
    {
      "@type": ["https://onerecord.iata.org/api/Operation"],
      "https://onerecord.iata.org/api/Operation#o": {
        "@type": ["https://onerecord.iata.org/api/OperationObject"],
        "https://onerecord.iata.org/api/OperationObject#datatype": "https://www.w3.org/2001/XMLSchema#string",
        "https://onerecord.iata.org/api/OperationObject#value": "3"
      },
      "https://onerecord.iata.org/api/Operation#op": "add",
      "https://onerecord.iata.org/api/Operation#p": "https://onerecord.iata.org/cargo/Item#lotNumber"
    }
  ],
  "https://onerecord.iata.org/api/PatchRequest#requestorCompanyIdentifier": "http://uri/companies/companyId",
  "https://onerecord.iata.org/api/PatchRequest#revision": "1"
}

The IRI p identifies the target property of resource identified by the logisticsObjectRef, and it works fine.

Now my Item is:

{
[...]
  "dimensions": {
    "height": {
      "unit": "cm",
      "value": 6
    },
    "length": {
      "unit": "cm",
      "value": 20
    },
    "volume": {
      "unit": "cubic meters",
      "value": 0.0012
    },
    "width": {
      "unit": "cm",
      "value": 10
    }
  },
  "product": {
    [...]
  },
  "unitPrice": {
    "unit": "USD",
    "value": 999.9
  },
  "weight": {
    "unit": "KG",
    "value": 0.3
  },
[...]
}

What would be the PATCH request body to modify the value of the volume of the dimensions of the Item?

(In this example dimensions is what is called a "blank node" and is considered as an inline structured object like we have in many classes of ONE Record data model)

grichka avatar Jun 15 '21 12:06 grichka

To be discussed with API & security group

lambertciata avatar Sep 03 '21 10:09 lambertciata

I would suggest to change "cubic meters" into "cbm"

image

JorreCobelens avatar Nov 24 '21 16:11 JorreCobelens

AFAIK the units and codes from IATA CargoXML are the ones to be used. So the unit code for cubic meters is 'MTQ'

mskopp avatar Nov 25 '21 08:11 mskopp

Thanks for correcting my dummy example. However, this has nothing to do with my original question :)

grichka avatar Nov 25 '21 08:11 grichka

Dear @grichka,

I am writing to inform you that we will be closing the issue. It has remained open for over two years. For detailed information on updating logistics objects, please refer to this link: Updating Logistics Objects.

Best regards, Davide

aloccid-iata avatar Feb 21 '24 09:02 aloccid-iata