-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Version in the JSON object response #257
Comments
Sounds reasonable. I vote in favour of 'Create a new property in the API ontology', as such information is meta information and would be better placed in the more technical API ontology rather than the business-oriented Cargo ontology. In the current API specification, we already have the HTTP header fields:
How about using the same naming for the properties? Example:
Best regards, |
Additional example with ?embedded=true With Shipment (rev=1) and linked Piece (rev=3) HTTP/1.1 200 OK
Content-Type: application/ld+json
Content-Language: en-US
Location: https://1r.example.com/logistics-objects/1a8ded38-1804-467c-a369-81a411416b3c
Type: https://onerecord.iata.org/ns/cargo#Shipment
Revision: 1
Latest-Revision: 1
Last-Modified: Tue, 21 Feb 2023 07:28:00 GMT
{
"@context": {
"cargo": "https://onerecord.iata.org/ns/cargo#",
"api": "https://onerecord.iata.org/ns/api#"
},
"@type": "cargo:Shipment",
"api:hasLatestRevision": 1,
"api:hasRevision": 1,
"cargo:goodsDescription": "Lots of awesome ONE Record information materials",
"cargo:pieces": [
{
"@type": "cargo:Piece",
"@id": " https://1r.example.com/logistics-objects/1a8ded38-1804-467c-a369-81a411416b7c",
"cargo:coload": {
"@type": "http://www.w3.org/2001/XMLSchema#boolean",
"@value": "false"
},
"api:hasLatestRevision": 3,
"api:hasRevision": 3,
"cargo:specialHandlingCodes": [
{
"@id": "https://onerecord.iata.org/ns/coreCodeLists#SpecialHandlingCode_VAL"
}
]
}
]
} |
The issue and the proposed solutions are reasonable. I support handling the issue as suggested by @ddoeppner, using the existing vocabulary of the api ontology I would not create new properties api#revision and api#latestRevision if they are the same as the pre-existing ones. |
Right! I overlooked the existence of these two... makes absolutely sense to reuse them! Edit: I updated the examples above accordingly. |
HI @ddoeppner and @NiclasScheiber, I definitely support your idea! Best, |
Issue description updated |
Thanks Davide, Nivclas, Daniel for this~! This API enhancement proposal if approved, would be extremely useful in optimizing API calls, especially when LOs are being updated. This is because any change request/ patch request to update an LO needs to have the specific version against which the request is being triggered ---- which is possible only if the LO is fetched via GET LO. If there are multiple LOs in a use case that has changed, the above proposed solution would help eliminate patch requestors from triggering individual GET LO calls for the sole purpose of retrieving the version number. |
Approved by API working group on the 16/09/2024 |
Problem Statement
Currently, the version of an object is provided only in the response header of a GET API call. When a user retrieves an object using the query parameter
embedded=true
, a collection of objects is returned, but only the version of the main object is included. As a result, the user must make an additional GET API call to obtain the version of any nested objects.Proposed Solution
To eliminate the need for a second API call, we propose including the version information directly in the JSON-LD response using the api ontology properties :
Example provided by @ddoeppner:
The text was updated successfully, but these errors were encountered: