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

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


===Base URL===
===Base URL===
<nowiki>http://app.views.coop/api/restful/work/sessiongroups/sessions/<sid>/participants</nowiki>
<nowiki>https://app.viewsapp.net/api/restful/work/sessiongroups/sessions/<sid>/participants</nowiki>
* '''sid''' - This is the id of the session group
* '''sid''' - This is the id of the session group


Line 35: Line 35:


===Adding participants to a bookable 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.
Due to financial information being required for bookable sessions, the method of adding participants in slightly different.


  curl --url <Base URL> -u<username>:<password> -H Content-Type:text/xml -X POST
  curl --url <Base URL> -u<username>:<password> -H Content-Type:text/xml -X POST
Line 62: Line 62:
* PaymentType - One of the following value 'Cash', 'Cheque', 'Debit Card', 'Credit Card', 'Other'
* PaymentType - One of the following value 'Cash', 'Cheque', 'Debit Card', 'Credit Card', 'Other'
* PaymentAmount - This is the amount paid
* PaymentAmount - This is the amount paid


===Adding a single participant to a session===
===Adding a single participant to a session===
Line 79: Line 78:
You can also upload a a list of participants to add to the session register via the following URL
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
  curl --url <Base URL> -u<username>:<password> -H Content-Type:text/xml -X PUT
This is an example of JSON data you must send on the server to add multiple participants
"participant": [
      {"ContactID":"101457","Attended":0},
      {"ContactID":"457","Attended":1, "Volunteering": "Volunteered|Made Coffee"},
      {"ContactID":"57","Attended":1, "Volunteering": "Cleaned Up"}
  ]


This can be useful for setting a register of attending participants.
This can be useful for setting a register of attending participants.
Line 102: Line 109:


==Removing participants from a session==
==Removing participants from a session==
===Removing participants from a non bookable session group===
You can remove a single participant from a session via the following:
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
  curl --url <Base URL>/<pid> -u<username>:<password> -H Content-Type:text/xml -X DELETE
Line 114: Line 124:
     <participant>103413</participant>
     <participant>103413</participant>
  </participants>
  </participants>
===Removing participants from a bookable session===
You can only remove a single participant's booking from a session group 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 remove
By default this will flag the participant as cancelled, but will not do anything with the financial side of the booking. To flag a refund was give or a credit note, you should pass the following:
<refundtype>Refund</refundtype>
or
<refundtype>Credit</refundtype>
This will result in the participants booking being completely being removed from the session
==Making payments to a booking==
curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X PUT -d '<xml>'
* *id* - This is the participant id
The data for submitting a payment record is currently quite basic. It is our intention to expand on this:
<payment>
    <PaymentType>Debit Card</PaymentType>
    <PaymentAmount>20</PaymentAmount>
</payment>
* PaymentType - This must be one of the following values 'Cash', 'Cheque', 'Debit Card', 'Credit Card', 'Other'
* PaymentAmount - This is an amount in pounds.pence
==Confirming/Unconfirming a booking==
curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X PUT -d '<xml>'
* *id* - This is the participant id
The data for submitting a payment record is currently quite basic. It is our intention to expand on this:
<booking>
    <Confirmed>1</Confirmed>
</booking>'
This can also be combined with a payment as such:
<payment>
    <PaymentType>Debit Card</PaymentType>
    <PaymentAmount>20</PaymentAmount>
    <Confirmed>1</Confirmed>
</payment>

Latest revision as of 08:36, 25 May 2023

Purpose

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

Base URL

https://app.viewsapp.net/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 sessions, 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 is an example of JSON data you must send on the server to add multiple participants

"participant": [
     {"ContactID":"101457","Attended":0},
     {"ContactID":"457","Attended":1, "Volunteering": "Volunteered|Made Coffee"},
     {"ContactID":"57","Attended":1, "Volunteering": "Cleaned Up"}
 ]

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

Removing participants from a non bookable session group

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>


Removing participants from a bookable session

You can only remove a single participant's booking from a session group 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 remove

By default this will flag the participant as cancelled, but will not do anything with the financial side of the booking. To flag a refund was give or a credit note, you should pass the following:

<refundtype>Refund</refundtype>

or

<refundtype>Credit</refundtype>

This will result in the participants booking being completely being removed from the session


Making payments to a booking

curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X PUT -d '<xml>'
  • *id* - This is the participant id

The data for submitting a payment record is currently quite basic. It is our intention to expand on this:

<payment>
    <PaymentType>Debit Card</PaymentType>
    <PaymentAmount>20</PaymentAmount>
</payment>
  • PaymentType - This must be one of the following values 'Cash', 'Cheque', 'Debit Card', 'Credit Card', 'Other'
  • PaymentAmount - This is an amount in pounds.pence


Confirming/Unconfirming a booking

curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X PUT -d '<xml>'
  • *id* - This is the participant id

The data for submitting a payment record is currently quite basic. It is our intention to expand on this:

<booking>
    <Confirmed>1</Confirmed>
</booking>'

This can also be combined with a payment as such:

<payment>
    <PaymentType>Debit Card</PaymentType>
    <PaymentAmount>20</PaymentAmount>
    <Confirmed>1</Confirmed>
</payment>