Rest - Work - Session Groups - Sessions: Difference between revisions

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


===Base URL===
===Base URL===
#<nowiki>http://app.views.coop/api/restful/work/sessiongroups/sessions</nowiki>
#<nowiki>https://app.viewsapp.net/api/restful/work/sessiongroups/sessions</nowiki>
#<nowiki>http://app.views.coop/api/restful/work/sessiongroups/<sig>/sessions</nowiki>
#<nowiki>https://app.viewsapp.net/api/restful/work/sessiongroups/<sig>/sessions</nowiki>
#* sig - This is an id of a SessionGroup
#* 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''
''Please be aware the the use of the 2nd base URL is only valid for searching sessions''


===Schema===
===Schema===
<nowiki>http://app.views.coop/api/restful/work/sessiongroups/sessions/schema(.xml|.json|.xsd)</nowiki>
<nowiki>https://app.viewsapp.net/api/restful/work/sessiongroups/sessions/schema(.xml|.json|.xsd)</nowiki>


==Search for Sessions==
==Search for Sessions==
  curl --url <Base URL #1>/search?q=<query> -u<username>:<password> -H Content-Type:text/xml  
  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  
  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
* query - This is a text string to use to search for in the session group records
Line 22: Line 22:
There are also a series of fields that you use -from and -to modifiers to express a range:
There are also a series of fields that you use -from and -to modifiers to express a range:
* StartDate - yyyy-mm-dd
* StartDate - yyyy-mm-dd
* EndDate - yyyy-mm-dd
* StartTime - hh:mm
* StartTime - hh:mm
* Duration - hh:mm
* Duration - hh:mm
Line 29: Line 28:
* Archived - yyyy-mm-dd
* Archived - yyyy-mm-dd


 
This will return something similar to the following:
<?xml version="1.0" encoding="utf-8"?>
<sessions count="9">
    <session id="25">
        <SessionID>25</SessionID>
        <SessionGroupID>7</SessionGroupID>
        <SessionType>Individual</SessionType>
        <Name>A session</Name>
        <StartDate>2011-03-03</StartDate>
        <StartTime>12:00</StartTime>
        <Duration>01:00</Duration>
        <Cancelled>0</Cancelled>
        <Activity>Water Sports</Activity>
        <LeadStaff>2</LeadStaff>
        <VenueID>1</VenueID>
        <Created>2011-03-07 15:57:05</Created>
        <CreatedBy>ant</CreatedBy>
        <Updated>2012-02-16 17:35:15</Updated>
        <UpdatedBy>ant</UpdatedBy>
        <RestrictedRecord>0</RestrictedRecord>
        <ContactType>Individual</ContactType>
    </session>
    <session id="68">
        <SessionID>68</SessionID>
        ...
    </session>
    ...
</sessions>


==Creating Sessions==
==Creating Sessions==
Line 35: Line 61:
To create a new session, you must do this via the session group API. This is because sessions must be
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.
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>"
  curl --url <Base URL #2> -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 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.
Line 42: Line 68:


==Fetching a Session==
==Fetching a Session==
  curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml
  curl --url <Base URL #1>/<id> -u<username>:<password> -H Content-Type:text/xml
 
Returns something similar to
<?xml version="1.0" encoding="utf-8"?>
<session id="25">
    <SessionID>25</SessionID>
    <SessionGroupID>7</SessionGroupID>
    <SessionType>Individual</SessionType>
    <Name>A session</Name>
    <StartDate>2011-03-03</StartDate>
    <StartTime>12:00</StartTime>
    <Duration>01:00</Duration>
    <Cancelled>0</Cancelled>
    <Activity>Water Sports</Activity>
    <LeadStaff>2</LeadStaff>
    <VenueID>1</VenueID>
    <Created>2011-03-07 15:57:05</Created>
    <CreatedBy>ant</CreatedBy>
    <Updated>2012-02-16 17:35:15</Updated>
    <UpdatedBy>ant</UpdatedBy>
    <RestrictedRecord>0</RestrictedRecord>
    <ContactType>Individual</ContactType>
</session>


==Updating a Session==
==Updating a Session==
  curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X PUT -d "<xml>"
  curl --url <Base URL #1>/<id> -u<username>:<password> -H Content-Type:text/xml -X PUT -d "<xml>"
* id - The ID of the session
* id - The ID of the session


Line 51: Line 99:


==Deleting a session==
==Deleting a session==
  curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X DELETE
  curl --url <Base URL #1>/<id> -u<username>:<password> -H Content-Type:text/xml -X DELETE
* id - The ID of the session
* id - The ID of the session


This should be used with great care as it will permanently delete a session groups record.
This should be used with great care as it will permanently delete a session groups record.
==Cancelling a session==
curl --url <Base URL #1>/<id>/cancel -u<username>:<password> -H Content-Type:text/xml -X PUT -d "<xml>"
* id - The ID of the session
There is no requirement to send any data to this, the call it's self is enough
==Restoring a cancelled a session==
curl --url <Base URL #1>/<id>/restore -u<username>:<password> -H Content-Type:text/xml -X PUT -d "<xml>"
* id - The ID of the session
There is no requirement to send any data to this, the call it's self is enough

Latest revision as of 13:05, 26 February 2016

Purpose

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


Base URL

  1. https://app.viewsapp.net/api/restful/work/sessiongroups/sessions
  2. https://app.viewsapp.net/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

https://app.viewsapp.net/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
  • StartTime - hh:mm
  • Duration - hh:mm
  • Created - yyyy-mm-dd
  • Updated - yyyy-mm-dd
  • Archived - yyyy-mm-dd

This will return something similar to the following:

<?xml version="1.0" encoding="utf-8"?>
<sessions count="9">
    <session id="25">
        <SessionID>25</SessionID>
        <SessionGroupID>7</SessionGroupID>
        <SessionType>Individual</SessionType>
        <Name>A session</Name>
        <StartDate>2011-03-03</StartDate>
        <StartTime>12:00</StartTime>
        <Duration>01:00</Duration>
        <Cancelled>0</Cancelled>
        <Activity>Water Sports</Activity>
        <LeadStaff>2</LeadStaff>
        <VenueID>1</VenueID>
        <Created>2011-03-07 15:57:05</Created>
        <CreatedBy>ant</CreatedBy>
        <Updated>2012-02-16 17:35:15</Updated>
        <UpdatedBy>ant</UpdatedBy>
        <RestrictedRecord>0</RestrictedRecord>
        <ContactType>Individual</ContactType>
    </session>
    <session id="68">
        <SessionID>68</SessionID>
        ...
    </session>
    ...
</sessions>

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 <Base URL #2> -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 #1>/<id> -u<username>:<password> -H Content-Type:text/xml

Returns something similar to

<?xml version="1.0" encoding="utf-8"?>
<session id="25">
    <SessionID>25</SessionID>
    <SessionGroupID>7</SessionGroupID>
    <SessionType>Individual</SessionType>
    <Name>A session</Name>
    <StartDate>2011-03-03</StartDate>
    <StartTime>12:00</StartTime>
    <Duration>01:00</Duration>
    <Cancelled>0</Cancelled>
    <Activity>Water Sports</Activity>
    <LeadStaff>2</LeadStaff>
    <VenueID>1</VenueID>
    <Created>2011-03-07 15:57:05</Created>
    <CreatedBy>ant</CreatedBy>
    <Updated>2012-02-16 17:35:15</Updated>
    <UpdatedBy>ant</UpdatedBy>
    <RestrictedRecord>0</RestrictedRecord>
    <ContactType>Individual</ContactType>
</session>

Updating a Session

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

Cancelling a session

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

There is no requirement to send any data to this, the call it's self is enough

Restoring a cancelled a session

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

There is no requirement to send any data to this, the call it's self is enough