Rest - Contacts - Participants - Address Book: Difference between revisions

From Views API Documentation
Jump to navigation Jump to search
mNo edit summary
Line 14: Line 14:
  <xml> should be in the following format:
  <xml> should be in the following format:
  <entry>
  <entry>
       <Forename>Sarah</Forename>
       <Forename>Jane</Forename>
       <Surname>McCaig</Surname>
       <Surname>Smith</Surname>
       <Type>Next of Kin</Type>
       <Type>Next of Kin</Type>
       <Relation>Wife</Relation>
       <Relation>Wife</Relation>
Line 51: Line 51:
     <ContactType>Individual</ContactType>
     <ContactType>Individual</ContactType>
     <ContactID>100554</ContactID>
     <ContactID>100554</ContactID>
     <Forename>Sarah</Forename>
     <Forename>Jane</Forename>
     <Surname>McCaig</Surname>
     <Surname>Smith</Surname>
     <Type>Next of Kin</Type>
     <Type>Next of Kin</Type>
     <Relation>Wife</Relation>
     <Relation>Wife</Relation>
Line 70: Line 70:
  </entry>
  </entry>


==Updating a Note==
==Updating an Address Book Entry==
  curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X PUT -d "<xml>"
  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
* id - The ID of the address book entry
Line 76: Line 76:
The XML should be in the same format as the create, as specified by the schema
The XML should be in the same format as the create, as specified by the schema


==Deleting a Note==
==Deleting an Address Book Entry==
''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
  curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X DELETE
* id - The ID of the address book entry
* id - The ID of the address book entry


This should be used with great care as it will permanently delete a note record.
This should be used with great care as it will permanently delete an address book entry.

Revision as of 12:43, 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>Jane</Forename>
     <Surname>Smith</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>Jane</Forename>
    <Surname>Smith</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 an Address Book Entry

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 an Address Book Entry

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 an address book entry.