DS RPC Operation Json Results

Hi there,

I am working on 2024.06 and want to handle results of DS RPC operations. How do I know the names of the JSON result of these, e.g. add Document seems to give a result node with a “docRef” key to use but I cannot find what it would be for any other operation (I need it for get document & list links especially). Do I need to use .getResult() and then, for list links, get “entries” (as an example response on bitbucket shows)?

Thanks in advance!

GetA12 documentation for the data services component has all this:

This links to version 2024.06-ext8

Thanks, maybe I am missing something there, but it only tells the type of result, not how to access it. In my code, I use myResponse.getResult(), and for add document, I saw someone use .get(“docRef”) to get the docRef of the created document. And this identifier, the structure of the response Json, is what I mean / need.

Hi @celina-slim-vale,

The Data Services (DS) team provides client libraries to access all JSON-RPC operations. For TypeScript, the dataservices-access module includes type guards to ensure improved type safety. For Java clients, we offer the RpcOperationsClient. The Java client results must be either cast to JsonNode to access values via paths, or handled using custom deserializers. These clients are intended for retrieving results from external servers.

For in-process calls, use the high-level API instead of the JSON-RPC overlay. The high-level API provides enhanced type safety and is more specific, as it does not require generic handling.

Thanks @tomas-thin-gale , I am indeed calling the RPC operations from a Java client (Camunda, but without A12WF). So when I have the response result in hand as Json node, all I want to know is its structure to be able to access the result part I need, e.g. the document in the Get document operation json node result. I imagine I could use .getResult().get(“document”) maybe?

Hi @celina-slim-vale ,

The GetDocumentOperation returns an instance of DocumentSpec, which is subsequently serialized into JSON. When you attempt to deserialize DocumentSpec from the operation result, only the docRef and modelName fields will be correctly deserialized. However, this information is redundant, as it is also provided in the operation parameters. The actual document content will remain as a string within the serialized result.

To obtain a fully-deserialized DocumentV2 object, you should use Kernel deserialization. Data Services offers a convenient method to create a DocumentV2 instance from a reader, which is accessible via the DocumentSupport#convertJSONToDocument method.

Hi @tomas-thin-gale ,

a string/Json document is fine, I just need to know how to access it in the result json. For example, there is a test get_document_response.json in the DS bitbucket which looks like there is a “document” key in the response json that I can access. Similarly, in the migration asciidoc folder there is an example response for list links, where it looks like I could access the “entries”.

I cannot post the links here unfortunately. If we should have a look in person, feel free to reach out on Webex. Thanks :slight_smile: