XiboAPI
From Xibo
| Languages: |
English |
Create an API for Xibo which supports all the transactions available in Xibo.
Contents |
Authorization
OAuth will be used to provide authorization for access to the Xibo API.
OAuth Information
Service location: services.php
OAuth methods:
- XRDS: services.php?xrds
- Request Token: services.php?service=oauth&method=request_token
- Authorize Token: index.php?p=oauth&q=authorize
- Access Token: services.php?service=oauth&method=access_token
XRDS
<?xml version="1.0" encoding="UTF-8"?>
<XRDS xmlns="xri://$xrds">
<XRD xmlns:simple="http://xrds-simple.net/core/1.0" xmlns="xri://$XRD*($v*2.0)" xmlns:openid="http://openid.net/xmlns/1.0" version="2.0" xml:id="main">
<Type>xri://$xrds*simple</Type>
<Service>
<Type>http://oauth.net/discovery/1.0</Type>
<URI>#main</URI>
</Service>
<Service>
<Type>http://oauth.net/core/1.0/endpoint/request</Type>
<Type>http://oauth.net/core/1.0/parameters/auth-header</Type>
<Type>http://oauth.net/core/1.0/parameters/uri-query</Type>
<Type>http://oauth.net/core/1.0/signature/HMAC-SHA1</Type>
<Type>http://oauth.net/core/1.0/signature/PLAINTEXT</Type>
<URI>http://Template:XRDS LOCATION/services.php?service=oauth&method=request_token</URI>
</Service>
<Service>
<Type>http://oauth.net/core/1.0/endpoint/authorize</Type>
<Type>http://oauth.net/core/1.0/parameters/uri-query</Type>
<URI>http://Template:XRDS LOCATION/index.php?p=oauth&q=authorize</URI>
</Service>
<Service>
<Type>http://oauth.net/core/1.0/endpoint/access</Type>
<Type>http://oauth.net/core/1.0/parameters/auth-header</Type>
<Type>http://oauth.net/core/1.0/parameters/uri-query</Type>
<Type>http://oauth.net/core/1.0/signature/HMAC-SHA1</Type>
<Type>http://oauth.net/core/1.0/signature/PLAINTEXT</Type>
<URI>http://Template:XRDS LOCATION/services.php?service=oauth&method=access_token</URI>
</Service>
</XRD>
</XRDS>
Registered Applications
You must obtain a consumer_key and consumer_secret for your application. Keys for "Supported" applications will be shipped with Xibo meaning no extra steps are required. If you have made your own application you will need to register it with your Xibo Server using the following address:
Register Service: index.php?p=oauth
You will be asked for:
- Your Name
- Your email address
- A URL for your Application
- A Callback URL
Xibo will (at a later date) have a UI for displaying all registered applications.
Callback URL
The Callback URL will be automatically called by Xibo on a completely Authorize request. It will be called regardless of whether the authorization was successful and will contain an OAuth message indicating the authorize success.
If you do not specify a Callback URL Xibo will show a message requesting the user return to the application once authorized.
Request Formats
Xibo supports the following request formats
- REST
REST
A simple POST or GET.
To request the Xibo Version method:
services.php?service=rest&method=version
By default the response type is xml. To get a different response type send "&response="
Response Types
Xibo supports the following response types
- JSON
- XML
JSON
To return a JSON object specify the response to be JSON (response="json")
A method call returns:
xiboApi({
"stat":"ok",
"response": {...}
})
A failure call returns:
xiboApi({
"stat":"error",
"error": {
"code": "[error-code]",
"message": "[error-message]"
}
})
XML
A successful call returns this:
<?xml version="1.0" encoding="utf-8" ?> <rsp status="ok"> [xml-payload-here] </rsp>
A failure call returns this:
<?xml version="1.0" encoding="utf-8" ?>
<rsp status="error">
<error code="[error-code]" message="[error-message]"
</rsp>
Error Codes
A complete list of error codes can be found here: http://wiki.xibo.org.uk/wiki/Error_codes
A list of the potential error codes from each method call can be found with the documentation of that call.
Methods
Transactions supported by Xibo
Displays
- DisplayList
- DisplayEdit
- DisplayRetire
- DisplayDelete
- DisplayUserGroupSecurity
- DisplayUserGroupEdit
DisplayGroups
- DisplayGroupList
- DisplayGroupAdd
- DisplayGroupEdit
- DisplayGroupDelete
- DisplayGroupMembersList
- DisplayGroupMembersEdit
- DisplayGroupUserGroupList
- DisplayGroupUserGroupEdit
Layout
- LayoutList
- LayoutAdd
- LayoutEdit
- LayoutCopy
- LayoutDelete
- LayoutRetire
- LayoutBackgroundList
- LayoutBackgroundEdit
- LayoutGetXlf
- LayoutRegionList
- LayoutRegionAdd
- LayoutRegionEdit
- LayoutRegionPosition
- LayoutRegionTimelineList
- LayoutRegionMediaAdd
- LayoutRegionMediaReorder
- LayoutRegionMediaDelete
- LayoutRegionLibraryAdd
- LayoutRegionMediaEdit
- LayoutRegionMediaDetails
Library
- LibraryMediaFileUpload
- LibraryMediaFileRevise
- LibraryMediaAdd
- LibraryMediaEdit
- LibraryMediaRetire
- LibraryMediaDownload
- LibraryMediaList
Schedule
- ScheduleList
- ScheduleAdd
- ScheduleEdit
- ScheduleDelete
Template
- TemplateList
- TemplateDelete
Resolution
- ResolutionList
Modules
- ModuleList
Other
- Version
- ServerStatus
Method Calls
LayoutAdd
Parameters
- layout - The Name of the Layout
- description - The Description of the Layout
- permissionid - PermissionID for the layout
- tags - Tags for the Layout
- templateid - Template for the Layout
Response
- layout - The ID of the layout
Errors
- Code 1 - Access Denied
- Code 25001 - Layout Name must be between 1 and 50 characters
- Code 25002 - Description must be less than 254 characters
- Code 25003 - All tags combined must be less that 254 characters
- Code 25004 - User already has a layout with this name
- Code 25005 - Database error adding layout
- Code 25006 - Failed to Parse Tags
- Code 25007 - Unable to update layout xml
- Code 25008 - Unable to Delete layout on failure
LayoutEdit
Not implemented
LayoutUpdateXlf
Not Implemented
LayoutBackground
Not Implemented
LayoutDelete
Parameters
- layoutId - The ID of the layout to delete
Response
- success = true
Errors
- Code 1 - Access Denied
- Code 25008 - Unable to delete layout
TemplateDelete
Parameters
- templateId - The ID of the template to delete
Response
- success = true
Errors
- Code 1 - Access Denied
- Code 25105 - Unable to delete template
LibraryMediaFileUpload
Parameters
- FileID - Null for 1st call
- Chunk Offset
- Check Sum (MD5)
Response
- FileID
- Offset (file length)
Errors
- 1 - Access Denied
- 2 - Payload Checksum doesn't match provided checksum
- 3 - Unable to add File record to the Database
- 4 - Library location does not exist
- 5 - Unable to create file in the library location
- 6 - Unable to write to file in the library location
- 7 - File does not exist
LibraryMediaAdd
Parameters
- fileId
- type (image|video|flash|ppt)
- name
- duration
- permissionId (1|2|3)
- fileName (including extension)
Response
- MediaID
Errors
- Code 1 - Access Denied
- Code 10 - The Name cannot be longer than 100 characters
- Code 11 - You must enter a duration
- Code 12 - This user already owns media with this name
- Code 13 - Error inserting media into the database
- Code 14 - Cannot clean up after failure
- Code 15 - Cannot store file
- Code 16 - Cannot update stored file location
- Code 18 - Invalid File Extension
LibraryMediaEdit
Parameters
- mediaId
- name
- duration
- permissionId (1|2|3)
Response
- success
Errors
- 1 - Access Denied
- 10 - The Name cannot be longer than 100 characters
- 11 - You must enter a duration
- 12 - This user already owns media with this name
- 30 - Database failure updating media
LibraryMediaFileRevise
Parameters
- mediaId
- fileId
- fileName (including extension)
Response
- mediaId
Errors
- 1 - Access Denied
- 13 - Error inserting media into the database
- 14 - Cannot clean up after failure
- 15 - Cannot store file
- 16 - Cannot update stored file location
- 18 - Invalid File Extension
- 31 - Unable to get information about existing media record
- 32 - Unable to update existing media record
LibraryMediaRetire
Parameters
- mediaId
Response
- success
Error Codes
- 1 - Access Denied
- 19 - Error retiring media
LibraryMediaDelete
Parameters
- mediaId
Response
- Success = True
Error Codes
- 1 - Access Denied
- 20 - Cannot check if media is assigned to layouts
- 21 - Media is in use
- 22 - Cannot locate stored files, unable to delete
- 23 - Database error deleting media
ModuleList
Response A list of modules with the following attributes:
- module - The Module Name
- layoutOnly- Whether the module is a library based module or only available for layouts
- description - A description of the module
- extensions - Extensions allowed by this module
Error Codes
- 40 - Unable to query for modules
Version
Response
<?xml version="1.0"?>
<rsp status="ok">
<version app_ver="1.1.1" XlfVersion="1" XmdsVersion="2" DBVersion="22"/>
</rsp>

