Rest - Contacts - Participants - Restrictions

From Views API Documentation
Jump to navigation Jump to search

Purpose

Used for creating, editing and deleting restrictions against a participant in the Views system.

Base URL

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

Schema

https://app.viewsapp.net/api/restful/contacts/participants/restrictions/scheme(.xml|.json|.xsd)

Adding a Restriction

curl --url <Base URL> -u<username>:<password> -H Content-Type:text/xml -X POST -d "<xml>"

<xml> should be in the following format:

   <restriction id="15">
     <RestrictionID>1</RestrictionID>
     <StartDate>0000-00-00</StartDate>
     <ExpiryDate>0000-00-00</ExpiryDate>
     <Note/>
   </restriction>

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.

Listing Restrictions

curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml

This will list all restrictions under a participant.

<?xml version="1.0" encoding="utf-8"?>
<participant id="19">
 <restrictions>
   <restriction id="15">
     <ID>15</ID>
     <PersonID>19</PersonID>
     <RestrictionID>1</RestrictionID>
     <StartDate>0000-00-00</StartDate>
     <ExpiryDate>0000-00-00</ExpiryDate>
     <Note/>
     <Created>2011-06-30 14:25:57</Created>
     <CreatedBy>jonathan</CreatedBy>
     <Updated>2014-02-25 09:55:16</Updated>
     <UpdatedBy>al.mccaig.transit</UpdatedBy>
     <Restriction>Abc</Restriction>
   </restriction>
 </restrictions>
</participant>

Fetching a Specific Restriction

curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml
  • id - The ID of the condition entry

This will return a records similar to the following:

<?xml version="1.0" encoding="utf-8"?>
<restriction id="15">
  <ID>15</ID>
  <PersonID>19</PersonID>
  <RestrictionID>1</RestrictionID>
  <StartDate>0000-00-00</StartDate>
  <ExpiryDate>0000-00-00</ExpiryDate>
  <Note/>
  <Created>2011-06-30 14:25:57</Created>
  <CreatedBy>jonathan</CreatedBy>
  <Updated>2014-02-25 09:55:16</Updated>
  <UpdatedBy>al.mccaig.transit</UpdatedBy>
  <Restriction>Abc</Restriction>
</restriction>

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 restriction entry

The XML should be in the same format as the create, as specified by the schema

Deleting a Restriction

curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X DELETE
  • id - The ID of the restriction entry

This should be used with great care as it will permanently delete restrictions from the participant.