Represents an offer. Common attributes:
Submission API specific attributes:
Distribution API specific attributes:
Data Example{ "id": "powierjg928euwfg2rwsureuew", "sku": "D3422343", "type": "deal", "title": "Flowers", "price": Currency , "discount": Discount , "fine_print": "", "start_date": "YYYY-MM-DD", "end_date": "YYYY-MM-DD", "quantity_in_stock": "287", "vouchers": list of Voucher , "published_at": "YYYY-MM-DD", "updated_at": "YYYY-MM-DD", "closed_at": "", "vouchers_expire": Expiration , "creative": Creative , "demographics": Demographics , "advertiser": Advertiser "custom_attributes": [{"name": "SKU", "value": "SU43234/DF"}, {"name": "pos_token", "value": "23487975973491934509213"}] } XML <offer> <id></id> <sku ></sku> <type ></type> <title ></title> <fine_print ></fine_print> <start_date ></start_date> <end_date ></end_date > <quantity_in_stock ></quantity_in_stock> <vouchers > ... <published_at ></published_at> <updated_at ></updated_at> <closed_at ></closed_at> <custom_attributes > <custom_attribute><name>SKU</name><value>SU43234/DF</value><custom_attribute> <custom_attribute><name>pos_token</name><value>23487975973491934509213</value><custom_attribute> </custom_attributes> </offer> ActionsCreate OfferPOST /offers Update OfferPUT /offers/<id> Query OffersGET /offers Get Offer DetailsGET /offers/<id> All examples are shown using command-line Curl and JSON output, but you can use XML and any other HTTP client tool/library as well. curl -X POST -F attachment[media]=@/path/to/your/file.jpg -H "Accept: application/json" -H "X-ADILITY-API-KEY:<YOUR_API_KEY>" "http://testapi.adility.com/submission/beta/attachments" Allowed file types are JPG/PNG/PDF/ZIP Step 2: get list of available categories curl -k -H "Content-Type: application/json" -H "Accept: application/json" -H "X-ADILITY-API-KEY:YOUR_SUBMISSION_API_KEY" 'http://testapi.adility.com/submission/beta/categories' Step 3: submit an offercurl -k -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "X-ADILITY-API-KEY:YOUR_SUBMISSION_KEY" ' http://testapi.adility.com/submission/beta/offers ' -d '{"offer": {"type": "deal","title": "Initial Chiropractic Exam","price":{"currency_code":"USD","amount": 3700},"value": {"currency_code": "USD","amount": 22500}, "advertiser_rebate": {"currency_code": "USD","amount": 1500},"fine_print": "Limit 1 per person per visit.", "start_date": "2011-07-15","end_date": "2012-07-26","quantity_in_stock": 200, "vouchers_expire": {"on": "2013-01-01"},"creative": {"requires_editorial_support": false,"headlines": ["$37 for an Initial Chiropractic Exam, X-Rays, and 10-Minute Mechanical Traction at Cohen Chiropractic Centre (Valued at $225.)","$37 for $225 Worth of Initial Chiropractic Exam, X-Rays, and 10-Minute Mechanical Traction"],"description": "The only thing worse than back pain is having trouble finding a good chiropractor to straighten you out.","original_media": [{ "id": "8e5096a4c4d2cbe5acc6871f1ccb268ae03ef0393c86702169242fb7c04ef258"}]}, "advertiser": {"name": "Cohen Chiropractic Centre","description": "Chiropractic offers natural relief of chronic pain","categories": [{"id": "2126128138"}],"redemption_locations": [{"address_line_1": "2140 Peachtree Rd NW","address_line_2": "Suite 203", "city": "Atlanta","state_code": "GA","postal_code": "30309","country_code": "US"}],"website_url": "http://www.CohenChiropracticCentre.com","public_phone": "(404) 355-5499"}}}' Step 4: update an offerIf you submitted an offer but want to edit it you should first withdraw it:curl -k -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -H "X-ADILITY-API-KEY:YOUR_SUBMISSION_API_KEY" 'http://testapi.adility.com/submission/beta/offers/OFFER_ID' -d '{"offer": {"status":"withdrawn"}}' Then you update the offer: curl -k -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -H "X-ADILITY-API-KEY:YOUR_SUBMISSION_API_KEY" 'http://testapi.adility.com/submission/beta/offers/OFFER_ID' -d '{"offer": {"price":{"currency_code":"USD","amount": 3800},"creative": {"requires_editorial_support": false,"headlines": ["$38 for an Initial Chiropractic Exam, X-Rays, and 10-Minute Mechanical Traction at Cohen Chiropractic Centre (Valued at $225.)","$38 for $225 Worth of Initial Chiropractic Exam, X-Rays, and 10-Minute Mechanical Traction"]}}}' and resubmit it: curl -k -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -H "X-ADILITY-API-KEY:YOUR_SUBMISSION_API_KEY" 'http://testapi.adility.com/submission/beta/offers/OFFER_ID' -d '{"offer": {"status":"pending"}}' Step 5: add comment on offercurl -k -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "X-ADILITY-API-KEY:YOUR_SUBMISSION_API_KEY" 'http://testapi.adility.com/submission/beta/offers/OFFER_ID/comments' -d '{"comment": {"author_name": "test author","content": "test comment"}' Step 6: suspend offercurl -k -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -H "X-ADILITY-API-KEY:YOUR_SUBMISSION_API_KEY" 'http://testapi.adility.com/submission/beta/offers/OFFER_ID' -d '{"offer": {"status":"suspended"}}' Step 7: resume offercurl -k -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -H "X-ADILITY-API-KEY:YOUR_SUBMISSION_API_KEY" 'http://testapi.adility.com/submission/beta/offers/OFFER_ID' -d '{"offer": {"status":"resumed"}}' Step 8: get distribution reportGeneral repor for last 5 dayst: curl -k -H "Content-Type: application/json" -H "Accept: application/json" -H "X-ADILITY-API-KEY:YOUR_SUBMISSION_API_KEY" 'http://testapi.adility.com/submission/beta/vouchers?recently_changed=5' Report by voucher: curl -k -H "Content-Type: application/json" -H "Accept: application/json" -H "X-ADILITY-API-KEY:YOUR_SUBMISSION_API_KEY" 'http://testapi.adility.com/submission/beta/offers/OFFER_ID/vouchers' Step 9: cancel the offercurl -k -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -H "X-ADILITY-API-KEY:YOUR_SUBMISSION_API_KEY" 'http://testapi.adility.com/submission/beta/offers/OFFER_ID' -d '{"offer": {"status":"cancelled"}}' Redeem voucherFor voucher redemption code samples please visit Voucher page. Getting callback on offer changeTo set your callback urls for sandbox and production you should contact us by skype or email api@adility.com. NOTE: after you submit an offer our submission team should review it and either approve or reject. On sandbox submission team role is played by me and our engineers. So you need to let us know you want your offer be approved, etc. You can do that in chat or by email to api@adility.com. |
8 API Reference > Resources >