Rest - Contacts - Participants: Difference between revisions
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 17: | Line 17: | ||
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. | ||
If the record was created successfully, the service will return a complete | If the record was created successfully, the service will return a complete record for the newly created record if the attribute id set as the newly created id. | ||
==Fetching a | ==Fetching a participant== | ||
curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml | curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml | ||
Line 45: | Line 45: | ||
curl --url <Base URL>/search?PersonID[]=xxx&PersonID[]=xxx&PersonID[]=xxx& -u<username>:<password> -H Content-Type:text/xml | curl --url <Base URL>/search?PersonID[]=xxx&PersonID[]=xxx&PersonID[]=xxx& -u<username>:<password> -H Content-Type:text/xml | ||
Depending on | Depending on howm any you are fetching, you may need to use POST rather than GET | ||
==Searching for a participant== | ==Searching for a participant== | ||
Line 96: | Line 96: | ||
* id - The ID of the participant | * id - The ID of the participant | ||
This should be used with great care as it will | This should be used with great care as it will permanently delete a participants record. |
Latest revision as of 08:50, 4 April 2025
Purpose
Used for creating, editing and deleting Participants from the Views system.
Base URL
https://app.viewsapp.net/api/restful/contacts/participants
Schema
https://app.viewsapp.net/api/restful/contacts/participants/schema(.xml|.json|.xsd)
Creating a participant
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 record for the newly created record if the attribute id set as the newly created id.
Fetching a participant
curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml
This will return an xml file similar to this
<?xml version="1.0" encoding="utf-8"?> <participant id="100001"> <Nickname></Nickname> <Forename>John</Forename> <Surname>Smith</Surname> ... <Created>2011-05-09 10:26:09</Created> <CreatedBy>a.user</CreatedBy> <Updated>2011-05-09 10:26:09</Updated> <UpdatedBy>a.user</UpdatedBy> <Archived>0000-00-00 00:00:00</Archived> <ArchivedBy></ArchivedBy> <Type>1</Type> <PersonID>100001</PersonID> <TypeName>participant</TypeName> </participant>
Fetching multiple partcipant records in one call
It is possible to use the search endpoint to retrieve multiple records
curl --url <Base URL>/search?PersonID[]=xxx&PersonID[]=xxx&PersonID[]=xxx& -u<username>:<password> -H Content-Type:text/xml
Depending on howm any you are fetching, you may need to use POST rather than GET
Searching for a participant
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 participants 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:
- DateOfBirth - yyyy-mm-dd
- Age - int (Please note that this is in days)
- Created - yyyy-mm-dd
- Updated - yyyy-mm-dd
- Archived - yyyy-mm-dd
Searching for a participant that has volunteered
This can be achieved by adding hasvolunteeres
to the search method as so:
curl --url <Base URL>/search?hasvoluteered&q=<query> -u<username>:<password> -H Content-Type:text/xml
The default is to filter the results to those that have volunteering records, however you can negate the search results by setting this parameter to one of the following values:
- 0
- no
- false
For example:
curl --url <Base URL>/search?hasvoluteered&q=<query> -u<username>:<password> -H Content-Type:text/xml
Updating a participant
curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X PUT -d "<xml>"
- id - The ID of the participant
The XML should be in the same format as the create XML. However, you only need to supply fields that you wish to update. For example:
<?xml version="1.0" encoding="utf-8"?> <participant id="100001"> <Forename>Jane</Forename> <Surname>Smith</Surname> </participant>
The above would result in updating participant 1000001's Forename and Surname values
Archiving a participant
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 participant
This will set the archive flag on a participant. If you set the status to 0, then it will remove the archive flag.
Deleting a participant
curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X DELETE
- id - The ID of the participant
This should be used with great care as it will permanently delete a participants record.