Using the API to post setup's to devices

Here is my code as of now:

import requests, sys
import json
from requests.auth import HTTPBasicAuth

newSetup = 'Kona-VidWall-Tuesday'
payload[u'setup'] = []
	u'name': u'Kona-Vidwall-Monday',
for outputList in devicelists:
	#print a
	url = ''+ outputList['serial']
	print(url),auth=HTTPBasicAuth('',api_key), data=json.dumps(payload))

It seems to work properly except when I login to my dashboard it doesn’t show the devices running the setup that I am looking for. Thoughts?

I recently modified to print the json response from the post and it is 403 which says that i’s forbidden. Not sure why that is.

Device specific information uses the device’s id, not its serial. So you’d have to use device['id'] for that. In that case the call seems redundant as the /list call already returns all information about all your devices.

If you want to assign a setup to a device, you’d call

r =
   url = "" % device_id,
   auth = HTTPBasicAuth('',api_key),
   data = {"setup_id": new_setup_id}

with device_id and new_setup_id set to the ids of the device/setup.

PS: If you paste code, surround it by ``` at the top/bottom. That way it get formatted properly and even colored. I’ve modified your post, so check out the edit button to see my changes.

I did this and it works now! I have a scheduling program running now and it works perfect! Thank you!!
I am wondering though, you’ve discussed that I can keep files locally and push them somehow to the PIs via the API. Not seeing that in the API documentation but maybe I’m missing it. Can you point me in the right direction to start looking at that?

There is no need to do this explicitly. If you assign a setup to a device (using for example an API call like the one above), the Pi will download all required files. This includes the assigned assets.

When you switch between setups, the Pi will also check if a file is already locally available from a previous download. If you have multiple setups and assign one of them on a daily cycle, almost no bandwidth is used once they have been all assigned once as all files are already cached locally.

Does that answer your question?

It helps answer the question of if the assets will be downloaded every time but I do see that it is a extra charge for space to store assets online, right? I also was unable to upload an asset the other day because it was too large. It was about a gigabyte I believe. Is that true? If that’s true won’t me storing locally and pushing to the PIs via an API help with that?

There’s a 512MB limit for videos right now. In most cases that was good enough so far as bigger videos either mean it’s really long or has an excessively high bitrate. Is that a single video or one that combines (for example) multiple ads into one big video?

Regardless of that: any content uses on the devices has to be stored in the info-beamer services. The content can’t be only on the devices as that would prevent (for example) automatic self-repairs and other features.