Using Python with Cumulocity

Follow

Hi there,

there was a question from a user about Python support in Cumulocity. With Python, it's really easy to use the REST APIs directly. Here's an example to get a list of devices from the inventory, where you need to fill in your URL, username and password:

import requests
from requests.auth import HTTPBasicAuth
import json

url = 'https://<your URL>.cumulocity.com/inventory/managedObjects?fragmentType=c8y_IsDevice&pageSize=2000'
auth = HTTPBasicAuth('<your user>', '<your password>')
response = requests.get(url, auth=auth)
devices = response.json()

Much more in the REST Developer's Guide, starting here: http://www2.cumulocity.com/guides/rest/introduction.html?lang=en.

Cheers,
André

 

Have more questions? Submit a request

Comments