I am using REST in Python 3.4 to create a data object in a table Latency. I’m following the documentation but nothing is being added to my table. I have four tables:
Latency
Location
Carrier
Latency
Location
LocationID
LocationCity
Carrier
CarrierID
CarrierName
Here is my curl code:
Popen(['curl', '-H', appid, '-H', secretkey, '-H', apptype, '-H', contenttype, '-X', 'POST', '-d', '{\"ownerId\":%d, \"Location\":{ \"LocationID\":1, \"LocationCity\":\"San Jose, CA\", \"___class\":\"Location\" }, \"Carrier\":{ \"CarrierID\":1, \"Carrier Name\":\"AT&T\", \"___class\":\"Carrier\" }, \"Latency\":%d} % (objectid, curl)', '-v', 'https://api.backendless.com/v1/data/Latency'])
This does absolutely nothing. I have tried removing the variables from the string and have gotten the same result.
Popen(['curl', '-H', appid, '-H', secretkey, '-H', apptype, '-H', contenttype, '-X', 'POST', '-d', '{\"ownerId\":\"1\", \"Latency\":\"250\"}', '-v', 'https://api.backendless.com/v1/data/Latency'])
What am I doing wrong? I know it’s not a problem with the authentication headers since I am able to retrieve the objectId without any problems.
Side question: Does the objectId act as a unique key? Does adding an objectId to an ownerId of another object create a relationship between the two?
Thanks in advance.