API Configuration Services
From ePrize Developers Wiki
(Adding basic GET,POST,PUT documentation) |
(Editing title+summary) |
||
(4 intermediate revisions not shown.) | |||
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 | ||
+ | }} | ||
+ | {{RESTfulExample | ||
+ | |title=Getting a list of configurations for an API key | ||
+ | |summary=Demonstrates retrieving a list of all configurations for a given public key | ||
+ | |request=GET https://eprize.api.promo.eprize.com/v2/({api_public_key})/apikey/configs | ||
+ | |responsecode=200 OK | ||
+ | |response=[{"appkey":"promo1","type":"mobileSdkV1"}, | ||
+ | {"appkey":"promo2","type":"mobileSdkV1"}, | ||
+ | {"appkey":"otherpromo,"type":"mobileSdkV1"}] | ||
+ | }} | ||
+ | {{RESTfulExample | ||
+ | |title=Getting a list of configurations for an API key + configurations | ||
+ | |summary=Demonstrates getting a list of configurations, along with their respective configurations | ||
+ | |request=GET https://eprize.api.promo.eprize.com/v2/({api_public_key})/apikey/configs/configuration | ||
+ | |responsecode=200 OK | ||
+ | |response={ | ||
+ | "promo1": { | ||
+ | "appearance": { | ||
+ | "tintColor": "black", | ||
+ | "assetUrls": {}, | ||
+ | "LocallyModified": 0, | ||
+ | "Active": 1 | ||
+ | }, | ||
+ | "lifecycle": { | ||
+ | "launchDate": "2012-11-29T17:57:06.710Z", | ||
+ | "endDate": "2013-02-28T17:57:06.710Z", | ||
+ | "LocallyModified": 0, | ||
+ | "Active": 1 | ||
+ | }, | ||
+ | "details": { | ||
+ | "displayUrl": "http://eprize.promo.eprize.com/.../", | ||
+ | "linkedAppkey": "", | ||
+ | "endpointUrl": "http://eprize.promo.eprize.com/.../", | ||
+ | "promoTitle": "ePrize Insiders", | ||
+ | "openInNativeBrowser": 0, | ||
+ | "authUrls": {}, | ||
+ | "LocallyModified": 0, | ||
+ | "Active": 1 | ||
+ | }, | ||
+ | "configType": "mobileSdkV1" | ||
+ | }, | ||
+ | "promo2": { | ||
+ | "appearance": { | ||
+ | "tintColor": "blue", | ||
+ | "assetUrls": {}, | ||
+ | "LocallyModified": 0, | ||
+ | "Active": 1 | ||
+ | },... <TRUNCATED FOR BREVITY> | ||
+ | |extranotes=The above output was truncated for brevity. You can see that the promo appkey is the key and the configuration is the value for each key. | ||
+ | }} | ||
+ | {{RESTfulExample | ||
+ | |title=Getting a list of ACTIVE configurations for an API key + configurations | ||
+ | |summary=Demonstrates getting a list of active configurations, along with their respective configurations | ||
+ | |request=GET https://eprize.api.promo.eprize.com/v2/({api_public_key})/apikey/activeConfigs/configuration | ||
+ | |responsecode=200 OK | ||
+ | |response={ | ||
+ | "promo1": { | ||
+ | "appearance": { | ||
+ | "tintColor": "black", | ||
+ | "assetUrls": {}, | ||
+ | "LocallyModified": 0, | ||
+ | "Active": 1 | ||
+ | }, | ||
+ | "lifecycle": { | ||
+ | "launchDate": "2012-11-29T17:57:06.710Z", | ||
+ | "endDate": "2013-02-28T17:57:06.710Z", | ||
+ | "LocallyModified": 0, | ||
+ | "Active": 1 | ||
+ | }, | ||
+ | "details": { | ||
+ | "displayUrl": "http://eprize.promo.eprize.com/.../", | ||
+ | "linkedAppkey": "", | ||
+ | "endpointUrl": "http://eprize.promo.eprize.com/.../", | ||
+ | "promoTitle": "ePrize Insiders", | ||
+ | "openInNativeBrowser": 0, | ||
+ | "authUrls": {}, | ||
+ | "LocallyModified": 0, | ||
+ | "Active": 1 | ||
+ | }, | ||
+ | "configType": "mobileSdkV1" | ||
+ | }, | ||
+ | "promo2": { | ||
+ | "appearance": { | ||
+ | "tintColor": "blue", | ||
+ | "assetUrls": {}, | ||
+ | "LocallyModified": 0, | ||
+ | "Active": 1 | ||
+ | },... <TRUNCATED FOR BREVITY> | ||
+ | |extranotes=The above output is truncated for brevity. | ||
+ | }} | ||
+ | {{RESTfulExample | ||
+ | |title=Getting a list of ACTIVE configurations for an API key. | ||
+ | |summary=Demonstrates retrieving a list of all active configurations for a given public key. Active means that the promotion is currently between its start and end dates. | ||
+ | |request=GET https://eprize.api.promo.eprize.com/v2/({api_public_key})/apikey/activeConfigs | ||
+ | |responsecode=200 OK | ||
+ | |response=[{"appkey":"promo1","type":"mobileSdkV1"}, | ||
+ | {"appkey":"promo2","type":"mobileSdkV1"}, | ||
+ | {"appkey":"otherpromo,"type":"mobileSdkV1"}] | ||
}} | }} |
Current revision
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
Example: Getting a list of configurations for an API key
Summary
Demonstrates retrieving a list of all configurations for a given public key
Request
GET https://eprize.api.promo.eprize.com/v2/({api_public_key})/apikey/configs
Response
HTTP Status Code: 200 OK
[{"appkey":"promo1","type":"mobileSdkV1"}, {"appkey":"promo2","type":"mobileSdkV1"}, {"appkey":"otherpromo,"type":"mobileSdkV1"}]
Example: Getting a list of configurations for an API key + configurations
Summary
Demonstrates getting a list of configurations, along with their respective configurations
Request
GET https://eprize.api.promo.eprize.com/v2/({api_public_key})/apikey/configs/configuration
Response
HTTP Status Code: 200 OK
{ "promo1": { "appearance": { "tintColor": "black", "assetUrls": {}, "LocallyModified": 0, "Active": 1 }, "lifecycle": { "launchDate": "2012-11-29T17:57:06.710Z", "endDate": "2013-02-28T17:57:06.710Z", "LocallyModified": 0, "Active": 1 }, "details": { "displayUrl": "http://eprize.promo.eprize.com/.../", "linkedAppkey": "", "endpointUrl": "http://eprize.promo.eprize.com/.../", "promoTitle": "ePrize Insiders", "openInNativeBrowser": 0, "authUrls": {}, "LocallyModified": 0, "Active": 1 }, "configType": "mobileSdkV1" }, "promo2": { "appearance": { "tintColor": "blue", "assetUrls": {}, "LocallyModified": 0, "Active": 1 },... <TRUNCATED FOR BREVITY>
Notes
The above output was truncated for brevity. You can see that the promo appkey is the key and the configuration is the value for each key.
Example: Getting a list of ACTIVE configurations for an API key + configurations
Summary
Demonstrates getting a list of active configurations, along with their respective configurations
Request
GET https://eprize.api.promo.eprize.com/v2/({api_public_key})/apikey/activeConfigs/configuration
Response
HTTP Status Code: 200 OK
{ "promo1": { "appearance": { "tintColor": "black", "assetUrls": {}, "LocallyModified": 0, "Active": 1 }, "lifecycle": { "launchDate": "2012-11-29T17:57:06.710Z", "endDate": "2013-02-28T17:57:06.710Z", "LocallyModified": 0, "Active": 1 }, "details": { "displayUrl": "http://eprize.promo.eprize.com/.../", "linkedAppkey": "", "endpointUrl": "http://eprize.promo.eprize.com/.../", "promoTitle": "ePrize Insiders", "openInNativeBrowser": 0, "authUrls": {}, "LocallyModified": 0, "Active": 1 }, "configType": "mobileSdkV1" }, "promo2": { "appearance": { "tintColor": "blue", "assetUrls": {}, "LocallyModified": 0, "Active": 1 },... <TRUNCATED FOR BREVITY>
Notes
The above output is truncated for brevity.
Example: Getting a list of ACTIVE configurations for an API key.
Summary
Demonstrates retrieving a list of all active configurations for a given public key. Active means that the promotion is currently between its start and end dates.
Request
GET https://eprize.api.promo.eprize.com/v2/({api_public_key})/apikey/activeConfigs
Response
HTTP Status Code: 200 OK
[{"appkey":"promo1","type":"mobileSdkV1"}, {"appkey":"promo2","type":"mobileSdkV1"}, {"appkey":"otherpromo,"type":"mobileSdkV1"}]