I am trying to run an API all against Plex using an API from their Developer Portal. PLEX Developer Portal
The json for the Request Body is giving me an error in the Script console "no viable alternative at input" where I define the body of the request.
This is the script
plexusUserNo = 12345
url = "https://connect.plex.com/platform/custom-fields/v1/field-values/save"
header = {"content-type":"application/json", "X-Plex-Connect-Api-Key": "APIKey"}
payload = [0:{"standardObjectName":"Employee", "recordIdentifiers":{"Plexus_User_No": plexusUserNo}, "customFields":{"RFID":5501}}]
client = system.net.httpClient()
response = client.post(url=url, headers=header, data= payload)
ds = system.util.jsonDecode(response.text)
print response
print ds
I get the error on the payload at the '0:'
SyntaxError: no viable alternative at input ':' (< input>, line 4)
The request body sample from the Dev Portal is
[
0:{
standardObjectName:"GLJournalDist",
recordIdentifiers:{
Journal_Link:7,
Line_Item_No:30113464
},
customFields:{
MyBooleanField:true,
MyCustomObjectRef:{},
MyDateField:"2023-10-29",
MyDateTimeField:"2023-10-24T15:50:00Z",
MyDecimalField:50.75,
MyIntegerField:20,
MyPartStandardObjectRef:{},
MyTextField:"Twenty Two"
}
}
]
I have successfully used other API calls from the Developer Portal as well as Plex Web Services. but none of those start with the square brackets [..]. I'm not sure what I am missing here and how to format this and get it to work.
Does anybody have any ideas?