AWS Thinkbox Discussion Forums

Issue with REST job submission

Hey there,

I’ve been trying to submit jobs using the REST API (this is with 6.2.0.16), and I’m consistently getting internal server errors with this unhelpful error message:

u"Error: Unexpected character encountered while parsing value: J. Path '', line 0, position 0. (Newtonsoft.Json.JsonReaderException)"

I’ve been trying a dead-simple test submission using code similar to:

import getpass
import requests

jobInfo = {'Plugin': 'CommandScript',
           'Frames': '0001'}
jsonData = {'JobInfo': jobInfo,
            'PluginInfo': {},
            'AuxFiles]: ['/path/to/some/globally/accessible/file.txt']}
r = requests.post('http://localhost:8080/api/jobs', auth=(getpass.getuser(), ''), data=jsonData)

I’m able to query things like the job and slave lists without any problem, but it seems like Deadline’s JSON decoding may be broken.

Is anyone successfully doing job submissions this way? Am I missing something here?

Thanks,

-Nathan

So I think I spoke too soon… I was under the impression requests was doing implicit JSON encoding of the data payload, but it isn’t.

Sorry for the noise.

Here’s the example I gave in the recent v6.1 webinar which covered the RESTful API / standalone Python API.

[code]import Deadline.DeadlineConnect as Connect

if name == ‘main’:

Deadline = Connect.DeadlineCon('mbp.local', 8080)

JobInfo = {
	"Name": "Submitted_via_Python_without_job_files",
	"UserName": "owenm",
	"Frames": "0-1",
	"Plugin": "VraySpawner"
	}

PluginInfo = {
	"Version": "Max2014"
	}

try:
	newJob = Deadline.Jobs.SubmitJob(JobInfo, PluginInfo)
	print newJob
except:
	print "Sorry, Pulse is currently down!"[/code]

See here for more info if you haven’t already seen this: thinkboxsoftware.com/deadlin … poverview/

Cheers,
Mike

Yeah, that one was just user error in that I overestimated just how “friendly” the requests package would try to be about converting POST data. After manually dumping everything to JSON, everything works as expected.

No worries! All feedback on the RESTful / standalone Python API’s are most warmly welcome here on the beta :slight_smile:

Privacy | Site terms | Cookie preferences