Example of lid usage

Hi there!

Is somewhere example usage of lid identifier? I cannot imagine use-case where lid can somehow appear in document and be useful. The only scenario which comes to my mind is when two different resource types are created. Like creating new order and new order-item then i can use lid as intended. But that is not possible in JSON:API. Creating resource is possible only one by one. So even if client want create multiple resource, it must call server for each individually, so even there isn’t lid necessary (for pairing purpose).

Second thing about lid is, if I understand it correctly, I have to return client-provided lid with newly created resource? Like I have tu remember that string through whole creating process and then add it to resource? Isn’t it a little bit heavy? Especially when on server lid does not carry any useful linking information as described before.

Intended lid usage is not well described in the specification yet. We have a pending ticket for adding a note clarify that: Explain intent of local identifiers in a note in the spec · Issue #1740 · json-api/json-api · GitHub

Please find more information on it in this topic in the meantime: How are local IDs supposed to be used?

2 Likes