Rest - Work - Session Groups: Difference between revisions

From Views API Documentation
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(5 intermediate revisions by the same user not shown)
Line 4: Line 4:


===Base URL===
===Base URL===
http://app.views.coop/api/restful/work/sessiongroups
https://app.viewsapp.net/api/restful/work/sessiongroups
 
===Schema===
<nowiki>https://app.viewsapp.net/api/restful/work/sessiongroups/schema(.xml|.json|.xsd)</nowiki>
 
 
==Fields and Specific Notes==
===Type===
The <code>Type</code> field should contain one of the following:
* Individual
* 121
* Group
* Participant (this is an alias for Individual)
* Event
* Volunteering
 
You should also be aware that this field indicates the type of attendance, for use as a standard Session Group you should use <code>Individual</code>
 
===Programmes===
This contains a pipe delimited list of Programme ID's that the Session Group is or is to be associated with.
<Programmes>2|5|8</Programmes>
 
===Projects===
This contains a pipe delimited list of Agency Progect ID's that the Session Group is or is to be associated with.
<Projects>2|5|8</Projects>
 
===BookingMode===
By default this is set to <code>None</code>. Possible values for this are:
* None
* SessionGroup
* Session
 
If you specify anything other <code>None</code> then the following fields are required:
* Cost
* BookingFee
 
===OtherStaff===
This contains a pipe delimited list of Staff ID's that are or to be associated with the Session Group
<OtherStaff>2002|152|87</OtherStaff>
 
 


==Searching for Session Groups==
==Searching for Session Groups==
Line 39: Line 79:


==Creating Session Groups==
==Creating Session Groups==
''As with all our services, the data structure can vary from account to account, depending how you have configured your system.
To get the expected schema for the data you need to supply, you should download the schema information from:
http://app.views.coop/api/restful/work/sessiongroups/schema''(.xml|.json|.xsd)''
Once you have created your data file, you can send it using the following:
Once you have created your data file, you can send it using the following:


Line 60: Line 95:


==Archiving a sessiongroups==
==Archiving a sessiongroups==
  curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X PUT -d '<status>1</status>'
  curl --url <Base URL>/<id>/archive -u<username>:<password> -H Content-Type:text/xml -X PUT -d '<status>1</status>'
* id - The ID of the session group
* id - The ID of the session group


This will set the archive flag on a session group. If you set the status to 0, then it will remove the archive flag.
This will set the archive flag on a session group. If you set the status to 0, then it will remove the archive flag.


==Deleting a sessiongroups==
<font color=red>'''''This should be used with great care as it will permanently delete a session groups record and many other associated records. It will also destroy all links to this Session Group to/from potentially many other records.'''''</font>


==Deleting a sessiongroups==
  curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X DELETE
  curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X DELETE
* id - The ID of the sessiongroups
* id - The ID of the sessiongroups
This should be used with great care as it will permenently delete a session groups record.

Latest revision as of 13:04, 26 February 2016

Purpose

Used for creating, editing and deleting sessiongroups from the Views system.

Base URL

https://app.viewsapp.net/api/restful/work/sessiongroups

Schema

https://app.viewsapp.net/api/restful/work/sessiongroups/schema(.xml|.json|.xsd)


Fields and Specific Notes

Type

The Type field should contain one of the following:

  • Individual
  • 121
  • Group
  • Participant (this is an alias for Individual)
  • Event
  • Volunteering

You should also be aware that this field indicates the type of attendance, for use as a standard Session Group you should use Individual

Programmes

This contains a pipe delimited list of Programme ID's that the Session Group is or is to be associated with.

<Programmes>2|5|8</Programmes>

Projects

This contains a pipe delimited list of Agency Progect ID's that the Session Group is or is to be associated with.

<Projects>2|5|8</Projects>

BookingMode

By default this is set to None. Possible values for this are:

  • None
  • SessionGroup
  • Session

If you specify anything other None then the following fields are required:

  • Cost
  • BookingFee

OtherStaff

This contains a pipe delimited list of Staff ID's that are or to be associated with the Session Group

<OtherStaff>2002|152|87</OtherStaff>


Searching for Session Groups

curl --url <Base URL>/search?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

Extra search parameters are:

  • BookingMode - The filters on the booking mode of the session group (None|Session|SessionGroup)
  • Archived - By default, only non-archived results are returned. Setting this parameter to 1 result in searching archived 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
  • PlannedSessions - int
  • AgeGroupFrom - int
  • AgeGroupTo - int
  • Created - yyyy-mm-dd
  • Updated - yyyy-mm-dd
  • Archived - yyyy-mm-dd

Searching for Bookable Session Groups

curl --url <Base URL>/bookable?q=<query> -u<username>:<password> -H Content-Type:text/xml 

This is exactly the same the normal Search API, with the exception that BookingMode is set to SessionGroup AND Session and thus passing a value of None to the BookingMode param will result in the parameter being ignored.

There are also a couple of extra fields that you can use the -from and -to modifiers to express a range:

  • Cost - int
  • BookingFee - int

Fetching a Session Group

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

Creating Session Groups

Once you have created your data file, you can send it using the following:

curl --url <Base URL> -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.


Updating a sessiongroups

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

The XML should be in the same format as the create XML.

Archiving a sessiongroups

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

This will set the archive flag on a session group. If you set the status to 0, then it will remove the archive flag.

Deleting a sessiongroups

This should be used with great care as it will permanently delete a session groups record and many other associated records. It will also destroy all links to this Session Group to/from potentially many other records.

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