Page 1 of 1

API question

Posted: Mon Jan 25, 2021 11:06 am
by Konogan
Hello happy switchers just a simple question :
i use the API to create and track a job.

How to attach metadatas with the API and retrieve it (always with the API) further in the process when the job is arrived in a checkpoint ?

The best solution would be to retrieve the metadata infos directly with the "Jobs - List" API operation.

Thank you for your help.

Re: API question

Posted: Mon Jan 25, 2021 11:52 am
by jan_suhr
With the Client Module you can access those functions over the Switch Rest API.

You can also do some magic with the HTTP Request tool and the WebHook tool

And if you have the Scripting module there is no limits on integration

Re: API question

Posted: Mon Jan 25, 2021 2:11 pm
by freddyp
The best solution would be to retrieve the metadata infos directly with the "Jobs - List" API operation
From the documentation you can see it does not work like that. The Jobs - List call returns an object and in the data field there is an array of objects for all the jobs you have access to. Each job object has a metadata field which is either true or false. So you have to loop over that array, check if the job has a checkpointId value (which means the job is in a checkpoint) and if the metadata field is true, then do another call to Jobs - Metadata to get the metadata fields.

Re: API question

Posted: Mon Jan 25, 2021 4:26 pm
by Konogan
Thank you for the feedback.
more than metadata I wanted to talk about private data, submit via the API on a submitPoint.
Data that I would like to retrieve later in my process with another API call on the job

Re: API question

Posted: Tue Jan 26, 2021 10:34 am
by freddyp
If you want to take over the checkpoint functionality and send the job to an outgoing connection of your choice and at the same time add private data, you can consider an alternative approach. Instead of using a checkpoint you use the "Remote process" element and you communicate with it using the Remote Processing API:
https://www.enfocus.com/manuals/Develop ... index.html
In the remote process that Switch calls you can do what you want and send a result back.

Note, however, that a remote process element blocks a processing channel until the remote process sends a result back. In other words, if your remote process does not immediately do something but it holds the job until a user does something you are quickly going to run out of processing channels and your Switch Server will virtually stop processing.

Re: API question

Posted: Tue Jan 26, 2021 2:17 pm
by Konogan
Thank you for the feedback.