REST API - passing variables to output preset

Hi,
Wondering if anyone has any pointers on how to get job info variables into an output preset using the REST API?
Should this sort of thing work, as I’m struggling with it (loads of status 400 returns)?

payload_py = {
        'identifier': job_set_id,
        'ProcessInformations': {
            'OriginalFilename': managed_job_id, 
            'JobInfos': {
                'JobInfo1': str(rpd_job_path)
            }
        }
    }

Thanks in advance,
T

You should be using runtime parameters, not JobInfos (which are a Workflow-specific structure).

You cannot pass runtime parameters directly to an output preset (yet!), but you can pass them to the Job Creation operation. You have to make sure that the Job Preset stores in its metadata the values it received in the parameters. You can then use those metadata fields in your output preset.

Hi Phil,
Thanks for the info - will give the Job Preset route a go. The only reason I’ve been using JobInfos is that I’ve no idea how to set parameters in the API.
How would the structure look - something like this?
‘ProcessInformations’: {
‘OriginalFilename’: managed_job_id,
‘Parameters’: {
‘MyFirstParameter’: str(rpd_job_path)
}
}
Many thanks,
Tim

Almost got it, no uppercase “P”. The structure is described in the help for the RESP API.

Hi Phil,
Defined the paramaters as per guide, but unfortunately all I get is this:
The automation property \"pres_dpf_path\" need to be defined as a variable in the Workflow process. (SRV000110) (SRV000017) (SRV000012) (SRV000001)","parameter":""
when I pass
‘ProcessInformations’: {
‘OriginalFilename’: filename,
‘parameters’: {
‘rpd_job_id’: str(rpd_job_id),
‘pres_dpf_path’: str(pres_dpf_path),
}
}
as the json payload along with an error in the associated postprocessor where I’m using the parameter like this:
var workingPath = automation.parameters.pres_dpf_path;
both parameters are defined in the python API script and work fine using JobInfos.
I’m missing something again aren’t I?

OK, I think there’s a bit of miscommunication here. Are you trying to pass those parameters to the DataMapper service or the JobCreation service?

Hi,
The same vars will be passed initially to the DataMapper, and later on to the JobCreation service.

OK, so check the documentation in the REST API for the exact structures to pass to both endpoints.

The structure should look something like this:

{
   "identifier" : <somevalue>,
   "parameters" : {
      "param1": <firstvalue>,
      "param2": <secondvalue>,

    }
}

For Job Creation, it’s identifiers (plural).

Magic, thanks Phil.
So, the parameters are not nested within ‘ProcessInformations’! Yep, that got the datamapper back for me. Today’s task is to figure out the Job / Output interaction.
Thanks again,
T


Oh dear. Seems I’m stuck again.
I don’t want / need to split the job at this point and have tried countless variations in the Job Output Mask section.
Surely there has to be a workaround that I’m unaware of?
Cheers,

Getting a bit frayed…
T

Hi @tim.dale,

I am afraid that – regarding the error message “Job level metadata is not supported in the job output mask” – there is unfortunately no workaround available for using a Job metadata field in the Job Output Mask option as only Job Segment, Document Set and Document metadata fields are supported in the Job Output Mask.