Experimental project

This is a sandbox project, which contains experimental code for developer use only.

Description

Scald Services is Services resource (hook_services_resources callback) for creating Scald atoms (media), eg. via json.

Currently only atom creation, not retrieval (easy to add, we'll see what the interest-level is like).

Works with uploaded files of any atom type (tested with atom types: image, audio, video, file). Also works with Scald Youtube and Scald Vimeo.

Installation

This project is provided as a features module. You need to have features installed.

Clone the repository into your modules directory then enable the scald_services feature. This will download and enable any unmet dependencies.

Visit http://{domain}/admin/structure/services/list/app/resources (user will need Administer Services permission) and look for a checked scald resource to confirm correct installation.

Usage

Authentication

You may add alternate authentication methods to the service component. As it is currently built, authentication occurs via first getting an X-CSRF token (http://{domain}/services/session/token), then logging in as a user with the appropriate permissions with the X-CSRF-Token set as a header (http://{domain}/app/user/login), and then hitting the endpoint (below) with the X-CSRF-Token header set.

Further info: https://www.drupal.org/node/2013781#comment-7508325.

Sorry, I am unable to help with general Services questions. Please refer to the Services module for general usage and authentication information.

Scald creation endpoint:

- http://{domain}/app/scald/create

Parameters:

- id (fid for already uploaded files for which you use a the default services file resource, youtube id, or vimeo id)
- external (either "youtube" or "vimeo" or leave out if using uploaded file)
- title (optional. If set, this becomes the title of the scald atom. If unset, the atom takes its title from the filename of the uploaded file, or the youtube title or the vimeo title)

Expected return

- "atom created", "sid"
- "atom exists", "sid"

Features of the Service

- checks for already existing scald atom. Requirements for match:
1. uploaded files: atom title, atom type, filesize, file md5 hash
2. youtube / vimeo: IDs must match

- atom type on uploaded files is determined by their mime type

- returns smart errors with a 406

- youtube / vimeo videos get height and width properties set according to source

- youtube / vimeo videos get their thumbnail from source

- proper title handling as described above

Supporting organizations: 

Project information