Rest - Work - Session Groups - Sessions

From Views API Documentation
Revision as of 08:07, 10 July 2012 by Wikiadmin (talk | contribs)
Jump to navigation Jump to search

Purpose

Used for creating, editing and deleting group sessions in the Views system.


Base URL

  1. http://app.views.coop/api/restful/work/sessiongroups/sessions
  2. http://app.views.coop/api/restful/work/sessiongroups/<sig>/sessions
    • sig - This is an id of a SessionGroup

Please be aware the the use of the 2nd base URL is only valid for searching sessions

Schema

http://app.views.coop/api/restful/work/sessiongroups/sessions/schema(.xml|.json|.xsd)

Search for Sessions

curl --url <Base URL #1>/search?q=<query> -u<username>:<password> -H Content-Type:text/xml 
curl --url <Base URL #2>?q=<query> -u<username>:<password> -H Content-Type:text/xml 
  • query - This is a text string to use to search for in the session group records

You can search for any field for a specific value by setting the field as a parameter. Please refer to the schema for fieldnames.

There are also a series of fields that you use -from and -to modifiers to express a range:

  • StartDate - yyyy-mm-dd
  • EndDate - yyyy-mm-dd
  • StartTime - hh:mm
  • Duration - hh:mm
  • Created - yyyy-mm-dd
  • Updated - yyyy-mm-dd
  • Archived - yyyy-mm-dd


Creating Sessions

To create a new session, you must do this via the session group API. This is because sessions must be created under a session group.

curl --url http://app.views.coop/api/restful/work/sessiongroups/<id>/sessions -u<username>:<password> -H Content-Type:text/xml -X POST -d "<xml>"

If there is a problem with creating that record, you will get a response containing all the errors, plus a copy of the translated data you supplied.

If the record was created successfully, the service will return a complete reocrd for the newly created record if the attribute id set as the newly created id.

Fetching a Session

curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml

Updating a Session

curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X PUT -d "<xml>"
  • id - The ID of the session

The XML should be in the same format as the create, as specified by the schema

Deleting a session

curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X DELETE
  • id - The ID of the session

This should be used with great care as it will permanently delete a session groups record.