Loading objects by resource ID in OSDK

Hello,

We are building an OSDK app using the TypeScript SDK, and are working with an API that returns object rids like ri.phonograph2-objects.main.object.48971f8a-fdff-4157-9cf4-aa3e98163be4.

We can’t find a way in the OSDK API nor in the general Foundry API to fetch objects by their rid. How can we fetch properties for our objects by their rids?

Something like this doesn’t work:

curl -X POST \
        -H "Content-type: application/json" \
        -H "Authorization: Bearer $TOKEN" \
        "https://$HOST/api/v2/ontologies/palantir/objects/person/search" \
        -d '{"where":{"type":"eq","field":"__rid","value":"ri.phonograph2-objects.main.object.48971f8a-fdff-4157-9cf4-aa3e98163be4"}}'
{"errorCode":"NOT_FOUND","errorName":"PropertiesNotFound","errorInstanceId":"ff60750c-8b34-42b4-b19f-b0982befa4fb","parameters":{"objectType":"person","properties":["__rid"]}}

Have you tried using Dev console and the TypeScript package we generate? this might help you both get the objects and properties as well keep a type safe code?

As for your question, Are you sure you have permission to the object and data? you might get not found due to permission issues,

The Load Object Set API call can be used to load objects by their rid. Example:

curl "https://$HOST/api/v2/ontologies/palantir/objectSets/loadObjects" \
    -H "Authorization: Bearer $TOKEN" \
    --json '{"objectSet":{"type":"static","objects":["ri.phonograph2-objects.main.object.48971f8a-fdff-4157-9cf4-aa3e98163be4"]}}'

This is not currently possible to do directly using the TypeScript SDK.