Page 1 of 1

Basic Help with API

Posted: Wed Oct 17, 2018 11:36 am
by dvdboy
I would like to try and submit a job to FFAStrans via the API, which is involving an extremely fast JSON learning curve :lol:

I'm initially trying to have a play with the 'Postman' chrome app to get an understanding with how things work.

I am executing a POST to the URL "http://<machine name>:65445/api/json/v1/jobs/"

With the body set to 'raw' JSON (application/json)

Code: Select all


{ 
	"wf_id": "20181017110349",
	"inputfile": "\\path\to\video.mov",
}

I discovered the wf_id by running:
http://<machine name>:65445/api/json/v1/workflows

I tried to include the start_proc variable by adding the id found using:
http://<machine name>:65445/api/json/v1/workflows/details/20181017110349

Which returned:

Code: Select all

{
wf_id: 20181017110349,
general: {
checksum: "B53D35C2E7042346062C15F9736C",
description: "",
folder: "",
wf_name: "VNTG01",
wf_id: 20181017110349
},
variable: {
start_procs: [
"enc_av_customff 20181017-110518-816-4252d857c755"
],
wf_size: 279.302087449219
},
maintainance: { },
special: { },
enc_av_customff 20181017-110518-816-4252d857c755: {
properties: {
custom_node_name: "BOBBY-B",
enabled: true,
execute_on: 3800889,
outbounds: [
"dest_folder 20181017-110753-786-cb9dde5647e8"
],
proc_x: 50,
proc_y: 50,
template: "BoB Proxy"
}
},
dest_folder 20181017-110753-786-cb9dde5647e8: {
properties: {
case: "None",
drop_ext: false,
drop_name: false,
enabled: true,
execute_on: 3800889,
folder: "\\Path\To\out",
outbounds: [ ],
overwrite: false,
prefix: "",
proc_x: 468,
proc_y: 50,
suffix: "",
unique: false
}
}
}
But as this was 'optional' I omitted it to reduce my error points.

I do get a 202 Accepted Status with the following response:

Code: Select all

{
    "uri": "http://<machine name>:65445/api/json/v1/jobs/20181017-123448-564-397656EA23CA",
    "job_id": "20181017-123448-564-397656EA23CA"
}
But the job doesn't execute. Am I doing something basic wrong?

Thanks

Re: Basic Help with API

Posted: Wed Oct 17, 2018 4:10 pm
by admin
Hi dvdboy :-)

In JSON, all backslash characters (\) must be escapet with a backslash (\\). So your JSON must look like:

Code: Select all

{ 
	"wf_id": "20181017110349",
	"inputfile": "\\\\path\\to\\video.mov",
}
https://www.freeformatter.com/json-escape.html

Try and see if that helps.

-steinar

Re: Basic Help with API

Posted: Thu Oct 18, 2018 12:47 pm
by dvdboy
That was it, job submitted and I can see it running on the Status Monitor!

Thankyou very much!

Out of interest, does anyone know if this plays nice with Telestream Vantage's HTTP Notifier?