Rest - Contacts - Participants - Address Book: Difference between revisions
m (→Creating Notes) |
|||
Line 40: | Line 40: | ||
* /authorisedcollectors | * /authorisedcollectors | ||
==Fetching an Address Book | ==Fetching an Address Book Entry== | ||
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 | ||
* id - The ID of the address book entry | * id - The ID of the address book entry |
Revision as of 12:37, 5 July 2012
Purpose
Used for creating, editing and deleting address book entires against a participant in the Views system.
Base URL
http://app.views.coop/api/restful/contacts/participants/<id>/addressbook
http://app.views.coop/api/restful/contacts/participants/<id>/addressbook/scheme is supported
Creating Address Book Entries
curl --url <Base URL> -u<username>:<password> -H Content-Type:text/xml -X POST -d "<xml>"
<xml> should be in the following format: <entry> <Forename>Sarah</Forename> <Surname>McCaig</Surname> <Type>Next of Kin</Type> <Relation>Wife</Relation> <Address1></Address1> <Address2></Address2> <Town>The Sticks</Town> <County></County> <Postcode></Postcode> <Telephone></Telephone> <Mobile></Mobile> <Email></Email> <CanCollect>1</CanCollect> </entry>
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.
Listing Address Book Entries
curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml
This will list all address book entires under a participant. I you wish to filter the address book to only return entiries that are allowed to pick the participant up from Sessions etc, then you can append the following:
- /authorisedcollectors
Fetching an Address Book Entry
curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml
- id - The ID of the address book entry
This will return a records similar to the following:
<?xml version="1.0" encoding="utf-8"?> <entry id="41"> <EntryID>41</EntryID> <ContactType>Individual</ContactType> <ContactID>100554</ContactID> <Forename>Sarah</Forename> <Surname>McCaig</Surname> <Type>Next of Kin</Type> <Relation>Wife</Relation> <Address1></Address1> <Address2></Address2> <Town>The Sticks</Town> <County></County> <Postcode></Postcode> <Telephone></Telephone> <Mobile></Mobile> <Email></Email> <CanCollect>1</CanCollect> <Created>2012-07-05 10:09:36</Created> <CreatedBy>al.mccaig.transit</CreatedBy> <Updated>2012-07-05 10:51:00</Updated> <UpdatedBy>al.mccaig.transit</UpdatedBy> </entry>
Updating a Note
curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X PUT -d "<xml>"
- id - The ID of the address book entry
The XML should be in the same format as the create, as specified by the schema
Deleting a Note
Please note You can only update participant notes via this api. For attendance and session notes, you should use the appropriate API.
curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X DELETE
- id - The ID of the address book entry
This should be used with great care as it will permanently delete a note record.