API Configuration Services
From ePrize Developers Wiki
(Adding basic GET,POST,PUT documentation) |
(Adding DELETE docs) |
||
Line 13: | Line 13: | ||
|title=Retrieve a configuration | |title=Retrieve a configuration | ||
|summary=This demonstrates successfully retrieving a configuration for an APP key | |summary=This demonstrates successfully retrieving a configuration for an APP key | ||
- | |request=GET https://eprize.api.promo.eprize.com/v2/{appkey}/configuration | + | |request=GET https://eprize.api.promo.eprize.com/v2/({appkey})/configuration |
|responsecode=200 OK | |responsecode=200 OK | ||
|response={"configType": "base","name": "somepromo","configDate": "2013-01-28T11:10:55.147-05:00"} | |response={"configType": "base","name": "somepromo","configDate": "2013-01-28T11:10:55.147-05:00"} | ||
Line 20: | Line 20: | ||
|title=Creating a new configuration | |title=Creating a new configuration | ||
|summary=This demonstrates creating a new configuration utilizing your public and private API keys. | |summary=This demonstrates creating a new configuration utilizing your public and private API keys. | ||
- | |request=POST https://eprize.api.promo.eprize.com/v2/{appkey}/configuration | + | |request=POST https://eprize.api.promo.eprize.com/v2/({appkey})/configuration |
|requestbody=mobileSdkV1 | |requestbody=mobileSdkV1 | ||
|responsecode=201 CREATED | |responsecode=201 CREATED | ||
Line 29: | Line 29: | ||
|title=Updating a configuration | |title=Updating a configuration | ||
|summary=This demonstrates updating a configuration value using the API. | |summary=This demonstrates updating a configuration value using the API. | ||
- | |request=PUT https://eprize.api.promo.eprize.com/v2/{appkey}/configurtion | + | |request=PUT https://eprize.api.promo.eprize.com/v2/({appkey})/configurtion |
|responsecode=200 OK | |responsecode=200 OK | ||
|response=The new configuration, same as a GET request for the same URL | |response=The new configuration, same as a GET request for the same URL | ||
|extranotes=An If-Match header must be set to the same value as the ETag header passed back in a GET request for the same URL. This helps prevent conflicts from being overwritten. This also requires the X-Public-Key and X-Private-Key headers to be set appropriately, same as a POST request. | |extranotes=An If-Match header must be set to the same value as the ETag header passed back in a GET request for the same URL. This helps prevent conflicts from being overwritten. This also requires the X-Public-Key and X-Private-Key headers to be set appropriately, same as a POST request. | ||
+ | }} | ||
+ | {{RESTfulExample | ||
+ | |title=Deleting a configuration | ||
+ | |summary=This demonstrates deleting a configuration via the API | ||
+ | |request=DELETE https://eprize.api.promo.eprize.com/v2/({appkey})/configuration | ||
+ | |responsecode=200 OK | ||
+ | |extranotes=This requires your public/private keypair to be passed in via the headers: X-Public-Key and X-Private-Key | ||
}} | }} |
Revision as of 16:38, 28 January 2013
Summary
Configuration Services allows promotion builders the ability to configure certain types of ePrize promotions to alter their behavior even while the promotion is live. Authorization is handled via API keys passed in the headers of requests that require auth.
NOTE: THIS IS NOT LIVE YET. We will update this page once the service goes into production.
Resource
/v2/{appkey}/configuration
Valid Methods
GET
Resource Arguments
Note: resource arguments are always required.
appkey: Your APP key.
Parameters Required
None.
Example: Retrieve a configuration
Summary
This demonstrates successfully retrieving a configuration for an APP key
Request
GET https://eprize.api.promo.eprize.com/v2/({appkey})/configuration
Response
HTTP Status Code: 200 OK
{"configType": "base","name": "somepromo","configDate": "2013-01-28T11:10:55.147-05:00"}
Example: Creating a new configuration
Summary
This demonstrates creating a new configuration utilizing your public and private API keys.
Request
POST https://eprize.api.promo.eprize.com/v2/({appkey})/configuration
Response
HTTP Status Code: 201 CREATED
The Location header will contain a URL to the newly created resource
Notes
You must also add two authorization headers to the request. X-Public-Key and X-Private-Key must be set to your public/private keypair. The "appkey" set in the URL is the name of the app to be created. If it already exists it WILL BE OVERWRITTEN. This is in place to allow changing the configuration type for a promotion.
Example: Updating a configuration
Summary
This demonstrates updating a configuration value using the API.
Request
PUT https://eprize.api.promo.eprize.com/v2/({appkey})/configurtion
Response
HTTP Status Code: 200 OK
The new configuration, same as a GET request for the same URL
Notes
An If-Match header must be set to the same value as the ETag header passed back in a GET request for the same URL. This helps prevent conflicts from being overwritten. This also requires the X-Public-Key and X-Private-Key headers to be set appropriately, same as a POST request.
Example: Deleting a configuration
Summary
This demonstrates deleting a configuration via the API
Request
DELETE https://eprize.api.promo.eprize.com/v2/({appkey})/configuration
Notes
This requires your public/private keypair to be passed in via the headers: X-Public-Key and X-Private-Key