Rest - Work - Agency Projects: Difference between revisions
(Created page with "==Purpose== Used for creating, editing and deleting Agency Projects from the Views system. ===Base URL=== http://app.views.coop/api/restful/work/agencyprojects ==Creating A...") |
No edit summary |
||
Line 5: | Line 5: | ||
===Base URL=== | ===Base URL=== | ||
http://app.views.coop/api/restful/work/agencyprojects | http://app.views.coop/api/restful/work/agencyprojects | ||
===Schema=== | |||
<nowiki>http://app.views.coop/api/restful/contacts/agencyprojects/schema(.xml|.json|.xsd)</nowiki> | |||
==Creating Agency Projects== | ==Creating Agency Projects== | ||
Once you have created your data file, you can send it using the following: | Once you have created your data file, you can send it using the following: | ||
Line 26: | Line 25: | ||
curl --url <Base URL>/search?q=<query> -u<username>:<password> -H Content-Type:text/xml | 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 agency project records | * query - This is a text string to use to search for in the agency project records | ||
You can search for any field for a specific value by setting the field as a parameter. Please refer to the schema for field names. | |||
There are also a series of fields that you use -from and -to modifiers to express a range: | |||
* Created - yyyy-mm-dd | |||
* Updated - yyyy-mm-dd | |||
* Archived - yyyy-mm-dd | |||
==Updating an Agency Project== | ==Updating an Agency Project== |
Revision as of 14:27, 9 July 2012
Purpose
Used for creating, editing and deleting Agency Projects from the Views system.
Base URL
http://app.views.coop/api/restful/work/agencyprojects
Schema
http://app.views.coop/api/restful/contacts/agencyprojects/schema(.xml|.json|.xsd)
Creating Agency Projects
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 reocrd for the newly created record if the attribute id set as the newly created id.
Fetching an Agency Project
curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml
Searching for Agency Projects
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 agency project records
You can search for any field for a specific value by setting the field as a parameter. Please refer to the schema for field names.
There are also a series of fields that you use -from and -to modifiers to express a range:
- Created - yyyy-mm-dd
- Updated - yyyy-mm-dd
- Archived - yyyy-mm-dd
Updating an Agency Project
curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X PUT -d "<xml>"
- id - The ID of the agency project
The XML should be in the same format as the create XML.
Archiving an Agency Project
curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X PUT -d '<status>1</status>'
- id - The ID of the agency project
This will set the archive flag on an Agency project. If you set the status to 0, then it will remove the archive flag.
Deleting an Agency Project
curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X DELETE
- id - The ID of the agencyprojects
This should be used with great care as it will permenently delete an Agency Projects record.