Rest - Contacts - Participants - Address Book

From Views API Documentation
Jump to navigation Jump to search

Purpose

Used for creating, editing and deleting address book entires against a participant in the Views system.

Base URL

https://app.viewsapp.net/api/restful/contacts/participants/<id>/addressbook

Schema

https://app.viewsapp.net/api/restful/contacts/participants/<id>/addressbook/scheme(.xml|.json|.xsd)

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.