API question

Post Reply
Konogan
Newbie
Posts: 3
Joined: Tue Dec 22, 2020 3:56 pm

API question

Post 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.
jan_suhr
Advanced member
Posts: 586
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: API question

Post 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
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
freddyp
Advanced member
Posts: 1009
Joined: Thu Feb 09, 2012 3:53 pm

Re: API question

Post 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.
Konogan
Newbie
Posts: 3
Joined: Tue Dec 22, 2020 3:56 pm

Re: API question

Post 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
freddyp
Advanced member
Posts: 1009
Joined: Thu Feb 09, 2012 3:53 pm

Re: API question

Post 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.
Konogan
Newbie
Posts: 3
Joined: Tue Dec 22, 2020 3:56 pm

Re: API question

Post by Konogan »

Thank you for the feedback.
Post Reply