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

From Views API Documentation
Jump to navigation Jump to search
Line 57: Line 57:
         <ContactID>457</ContactID>
         <ContactID>457</ContactID>
         <Attended>1</Attended>
         <Attended>1</Attended>
        <Volunteering>Volunteered|Made Coffee</Volunteering>
     </participant>
     </participant>
     <participant>
     <participant>
         <ContactID>57</ContactID>
         <ContactID>57</ContactID>
         <Attended>1</Attended>
         <Attended>1</Attended>
        <Volunteering>Cleaned Up</Volunteering>
     </participant>
     </participant>
  </participants>
  </participants>
'''''Please note:''' This will replace all existing participant data for the session''


==Removing participants from a session==
==Removing participants from a session==

Revision as of 11:40, 22 October 2013

Purpose

Used for administering participation by participants at sessions in the Views system.

Base URL

http://app.views.coop/api/restful/work/sessiongroups/sessions/<sid>/participants

  • sid - This is the id of the session group

Getting the list of participants

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

This will return a list of participants that are associated with a session, similar to the following:

<session id="7">
    <participants>
        <participant id="123">
            <SessionID>25</SessionID>
            <SessionGroupID>7</SessionGroupID>
            <Name>Jane Smith</Name>
            <ContactType>Individual</ContactType>
            <Attended>0</Attended>
        </participant>
        <participant id="102">
            <SessionID>25</SessionID>
            <SessionGroupID>7</SessionGroupID>
            <Name>John Smith</Name>
            <ContactType>Individual</ContactType>
            <Attended>1</Attended>
        </participant>
    <participants>
</sessiongroup>

Adding Participants to a session

Adding a single participant to a session

You can add a single participant via the following:

curl --url <Base URL> -u<username>:<password> -H Content-Type:text/xml -X PUT
<participant>
    <ContactID>101457</ContactID>
    <Attended>0</Attended>
    <Volunteering>Volunteered|Made Coffee</Volunteering>
</participant>

The value for Attended is either 1 or 0, 1 = Attended. This is optional and will default to 0, unless the session has started, in which case the default is 1.

Adding multiple participants to a session

You can also upload a a list of participants to add to the session register via the following URL

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

This can be useful for setting a register of attending participants.

<participants>
    <participant>
        <ContactID>101457</ContactID>
        <Attended>0</Attended>
    </participant>
    <participant>
        <ContactID>457</ContactID>
        <Attended>1</Attended>
        <Volunteering>Volunteered|Made Coffee</Volunteering>
    </participant>
    <participant>
        <ContactID>57</ContactID>
        <Attended>1</Attended>
        <Volunteering>Cleaned Up</Volunteering>
    </participant>
</participants>

Please note: This will replace all existing participant data for the session

Removing participants from a session

You can remove a single participant from a session via the following:

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

You can also upload a a list of participants to remove from the session via the following URL

curl --url <Base URL> -u<username>:<password> -H Content-Type:text/xml -X DELETE
<participants>
    <participant>101162</participant>
    <participant>103124</participant>
    <participant>103413</participant>
</participants>