Hi all,
Please could someone give me a short example on how to create an object using the API and python.
I am familiar with most aspects of python but calling APIs is not thing thing im able to d just yet.
Im sure with a short example i will be able to get going.
I am able to call the API
import requests
response = requests.get('https://insight-api.riada.io/rest/insight/1.0/objectschema/list', headers={'Authorization': 'MYTOKEN HERE'})
print(response.json())
But then im stuck.
below is the object i am trying to create.
Thanks
OK so i think i figured this out,
Below is what ive used to successfully create an object based on the example data i gave above.
If anyone has a better way to do it, please comment
import requests
customercreate = {
"objectTypeId": 6,
"attributes": [
{
"objectTypeAttributeId": 38,
"objectAttributeValues": [{
"value": "MYVALUE"}]
},
{
"objectTypeAttributeId": 46,
"objectAttributeValues": [{
"value": "MYVALUE"}]
},
{
"objectTypeAttributeId": 48,
"objectAttributeValues": [{
"value": "MYVALUE"}]
},
{
"objectTypeAttributeId": 47,
"objectAttributeValues": [{
"value": "MYVALUE"}]
},
{
"objectTypeAttributeId": 49,
"objectAttributeValues": [{
"value": "MYVALUE"}]
}]
}
response = requests.post('https://insight-api.riada.io/rest/insight/1.0/object/create',
headers={'Authorization': 'MYTOKEN'}, json = customercreate)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.