Uploading Media through API

Does XIBO API provides the function to add a media file [video, image etc]


I think you could start here :slight_smile:


1 Like

Or if you are on 1.8, you can start here: http://xibo.org.uk/manual-tempel/en/api.html or here 1.8 API Introduction

I am using XIBO 1.7.9 and going through the API documentation at http://xibo.org.uk/manual-tempel/api/ I see only functions to tag or untag media.

Does XIBO 1.7.9 supports to add media files through API ?

The API documentation you linked is for 1.8 and 1.8 does support everything, regarding media - the media upload (library/add) and assign (playlist/library/assign) are the ones you’re looking for - which is described step by step in my guide linked by Dan.

Now, 1.8 does support adding/editing of all modules (not only media based), but it’s not documented yet - we’re in the process of doing that along with the tests for them.

Regarding 1.7 API, you can have a look here - http://xibo.org.uk/2014/02/19/scripting-xibo-content-management-a-brief-tour-of-the-api/ or http://xibo.org.uk/manual/en/api_library.html

You will find that, being a BETA, the 1.7 api is not as full featured as 1.8 and lacks documentation. For API use we’d recommend to either use 1.8.0-rc2 currently available or wait for full release.

Sorry to dig up an old item, but is there any plans to add the ability to assign media to a display on a schedule instead of using a display group? We currently have over 100 displays (and growing) that we are assigning to different media feeds. We are using the API to get an image from a feed and assign to a display group. However, we need to do many different feeds and we don’t want to create a display group per display.

Just thought I would ask.

Thanks, guys!

No problem.

Each display already has its own display group created for you - you can get the ID from the GET /display API call. We call this the “display specific display group” - snappy!

I think this means you already have what you need?

i am able to upload through postman. However, when I check the file in the CMS it just shows a red x as if postman didn’t send any file data. Any ideas?

1 Like

Could you confirm CMS version please?
and if it’s docker or manual installation?

If you upload the same file to the CMS via web ui does it get correctly displayed?

this is my python code

import requests
import json

token_url = ‘http://mydomain/api/authorize/access_token’
library = ‘http://mydomain/api/library’

client_id = ‘*********’
client_secret = ‘************************’

data = {‘grant_type’:‘client_credentials’}

access_token_response = requests.post(token_url,data=data,verify=False,allow_redirects=False,auth=(client_id, client_secret))

tokens = json.loads(access_token_response.text)

print("Bearer " + tokens[‘access_token’])

headers = {‘Authorization’: "Bearer " + tokens[‘access_token’],‘Cache-Control’:‘no-cache’,‘content-type’: ‘multipart/form-data’}

payload = {‘Content-Disposition’: ‘form-data’,‘name’:‘files’,‘filename’:“image.jpg”,}

data = json.dumps(payload)
response = requests.request(‘POST’,library,data=data,headers=headers)

i’m getting this error with xibo upload api

“files”:[{“name”:“1492523640-7615”,“size”:1316610,“type”:“multipart/form-data; boundary=--------------------------449316675376425057078541”,“error”:“Filetype not allowed”}]}

i’m using xibo 1.8.9 version …

please give me solution