1. Help Center
  2. Advanced Technical Use Cases

Custom Coupon Fetching (Developer Guide)

This article covers the following material:

  1. Navigating The Coupon Fetch User Interface
  2. Choosing The Server Authentication Method
  3. Choosing The Request Type
  4. Details on Miscellaneous Options
  5. Testing API Responses

 

Navigating The Coupon Fetch User Interface

Start at the promotion management view, select a promotion that has a unique coupon box layer, and proceed to click through the options menu to the coupon settings.

Step 1:

edit coupons

Step 2:

fetch coupon code

Step 3:

use custom

Step 4:

create auth type

 

Choosing The Server Authentication Method

Authentication types include:

  • No Auth - No authentication required for your coupon endpoint/API
  • Basic Auth - Username and Password are required for coupon endpoint/API
  • Digest Auth - Identical from UI standpoint to the Basic Authentication option.
  • Query String - Appends anything from authentication option to the query string
  • Headers - This appends anything from the authentication options to the headers of the request made to the endpoint.
  • OAuth v2 - Client ID, client secret. authorization url, and access token url are all required for this option. Once given you can 'fetch tokens' so that you can start the OAuth process to retrieve the tokens.
    • Refresh token is an optional feature.

 

No Authentication

configure coupon

Basic Authentication

basic auth

Digest Authentication

digest auth

Query String Authentication

query string auth

Headers Authentication

headers auth

OAuth v2 Authentication

oauth v2

 

Choosing The Request Type

There are 3 available request types accessible within the Custom Coupon UI interface:

  1. GET - Makes a simple GET request at your set endpoint URI
  2. POST (JSON or FORM) - With both of these post options you have the ability to send a payload, that is anything your endpoint might need in the data body to process the request.
    1. POST (JSON) - Makes a POST request with the header: content-type: application/json
    2. POST (FORM) - Makes a POST request with the header: content-type: application/x-www-form-urlendoded

 

 

Example:

Digest Authentication POST

digest auth post

Example:

Query String Authentication - POST

query string auth post

Example:

Headers Authentication - POST

headers auth post

 

Details on Miscellaneous Options

 

  • Single Coupon vs Bulk Coupon Type
    • This indicates whether your API/Endpoint response will be one coupon or a multitude of coupon codes

 

 

  • Code/Expire JSON mapping
    • If your response is JSON, this will be required to extract the appropriate keys from the JSON, for example: If the response result is:
      • [data: { coupon: ‘coupon_code’ }]
        Your JSON mapping would look like:
      • result.0.data.coupon

 

    • The same logic applies for extracting 'expiration dates'

 

 

Testing API Response

The configuration you set can be quickly tested using the 'Test Configuration' button at the bottom of the interface window. The success message reads "Configuration Works!" followed by the response from the API/Endpoint.

testing api

 

 

Tags: Auto Fetch, Bulk Coupon, Coupon, Custom Coupon, Dynamic Coupons, Fetch