Page 1 of 1

Web Server REST API - PUT Clip By ID Transport Position

Posted: Tue Apr 04, 2023 01:56
by NEWP_Official
Hey hivemind. I can use Touch Designer's Web Render Top and Web Client Dat to GET and POST Rest API commands like get thumbnail and connect clip by ID. I would like to update the Transport Position of a Clip by Clip ID. I would expect the following to work:

op("REZQ_1_PostOut").request('http://127.0.0.1:8080/api/v1/compositio ... d/<clip_id>', 'PUT', data={'transport': {'position': {'value': float(op("REZQ_1_PostRange")[0])}}})

to work, however I am getting a "JSON parse error: 'Invalid value.' (offset:2)" data response

so i then try:

op("REZQ_1_PostOut").request('http://127.0.0.1:8080/api/v1/compositio ... d/<clip_id>', 'PUT', data={'position': float(op("REZQ_1_PostRange")[0])})

and I get a "JSON parse error: 'Invalid value.' (offset: 0)


I even then tried doing something along the lines of:
jsonData = {
"transport": {
"position": {
"value": float(op("REZQ_1_PostRange")[0])
}
}
}
jsonData = json.loads(jsonData)

#op("REZQ_1_PostOut").request('http://127.0.0.1:8080/api/v1/compositio ... d/<clip_id>', 'PUT', data=jsonData)



to no avail. How should I update a clip timeline position with the Web Server Rest API?

Re: Web Server REST API - PUT Clip By ID Transport Position

Posted: Thu Apr 06, 2023 15:42
by NEWP_Official
Solved my PUT JSON request by formatting my Python Dictionary with json.dumps() as well as declaring the contentType to be 'application/json' in my web client dat request() call