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

From Views API Documentation
Jump to navigation Jump to search
Line 33: Line 33:


==Adding Participants to a session==
==Adding Participants to a session==
===Adding participants to a bookable session===
Due to financial information being required for bookable session groups the method of adding participants in slightly different.
curl --url <Base URL> -u<username>:<password> -H Content-Type:text/xml -X POST
<participant>
    <PersonID>100748</PersonID>
    <PaymentType>Debit Card</PaymentType>
    <PaymentAmount>20</PaymentAmount>
    <PaymentFee>2.50</PaymentFee>
    <PaymentReference>7002</PaymentReference>
    <Forename>Father</Forename>
    <Surname>Test</Surname>
    <Address1/>
    <Address2/>
    <Town/>
    <County/>
    <Postcode/>
    <Telephone/>
    <Email>test@test.com</Email>
</participant>
This will return errors on a fail or the full booking record on a successful submit.
The required fields are all required:
* PersonID - This is the ID of the participant
* PaymentType - One of the following value 'Cash', 'Cheque', 'Debit Card', 'Credit Card', 'Other'
* PaymentAmount - This is the amount paid
===Adding a single participant to a session===
===Adding a single participant to a session===
You can add a single participant via the following:
You can add a single participant via the following:

Revision as of 14:13, 25 August 2015

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>
            <Volunteering></Volunteering>
        </participant>
        <participant id="102">
            <SessionID>25</SessionID>
            <SessionGroupID>7</SessionGroupID>
            <Name>John Smith</Name>
            <ContactType>Individual</ContactType>
            <Attended>1</Attended>
            <Volunteering>Made Coffee</Volunteering>
        </participant>
    <participants>
</sessiongroup>

Adding Participants to a session

Adding participants to a bookable session

Due to financial information being required for bookable session groups the method of adding participants in slightly different.

curl --url <Base URL> -u<username>:<password> -H Content-Type:text/xml -X POST
<participant>
    <PersonID>100748</PersonID>
    <PaymentType>Debit Card</PaymentType>
    <PaymentAmount>20</PaymentAmount>
    <PaymentFee>2.50</PaymentFee>
    <PaymentReference>7002</PaymentReference>
    <Forename>Father</Forename>
    <Surname>Test</Surname>
    <Address1/>
    <Address2/>
    <Town/>
    <County/>
    <Postcode/>
    <Telephone/>
    <Email>test@test.com</Email>
</participant>

This will return errors on a fail or the full booking record on a successful submit.

The required fields are all required:

  • PersonID - This is the ID of the participant
  • PaymentType - One of the following value 'Cash', 'Cheque', 'Debit Card', 'Credit Card', 'Other'
  • PaymentAmount - This is the amount paid


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>