How are local IDs supposed to be used?

Section 7.2.1 (Identification) suggests to use a “lid” member inside of resource identifier objects to identify the resource locally within the document when creating new resources. But the specification does not provide further examples.

When creating a new resource, the corresponding JSON:API document can only contain the one resource object that should be created on the server. Where in the document may the primary resource be referenced by the “lid” member?

Thanks for clarification!

The local identifier (lid) is expected to be used by extensions. An example is the Atomic Operations extension.

Thanks for your answer. That point is not clearly stated in the specification. Or did I miss it?

But when the only use of the local identifier is by extensions, shouldn´t it be specified by the corresponding extension instead of the official specifictation?

A note explaining intent of local identifiers / lid may be helpful indeed. I created Explain intent of local identifiers in a note in the spec · Issue #1740 · json-api/json-api · GitHub to track it.

The assumption was that many extensions need local identifiers. It was added to base specification to avoid multiple solutions to the same problem and compatibility issues. If I got it right. @dgeb feel free to correct me as I wasn’t part of the discussions at that time.

1 Like

I think that you’ve got it at least 99% right. The rationale you’re missing is a very subtle one which involves creating a resource with a relationship to the same resource. While we couldn’t find any non-contrived examples we also didn’t want to punt at the same time we are adding extensions.

I think your note will add some useful clarity.

1 Like