List Coupons
Retrieve a list of all coupons.
You can filter the list with query parameters.
ending_before
The ID of the coupon created after the last coupon you want to retrieve.
limit
The maximum number of coupons to return. Range: 1-100.
10
starting_after
The ID of the coupon created before the first coupon you want to retrieve.
Code Samples
.NET
using System; namespace RapydApiRequestSample { class Program { static void Main(string[] args) { try { string result = RapydApiRequestSample.Utilities.MakeRequest("GET", "/v1/coupons"); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Error completing request: " + e.Message); } } } }
JavaScript
const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest; async function main() { try { const result = await makeRequest( 'GET', '/v1/coupons' ); console.log(result); } catch (error) { console.error('Error completing request', error); } }
PHP
<?php $path = $_SERVER['DOCUMENT_ROOT']; $path .= "/<path-to-your-utility-file>/utilities.php"; include($path); try { $object = make_request('get', '/v1/coupons'); var_dump($object); } catch(Exception $e) { echo "Error =>$e"; } ?>
Python
from pprint import pprint from utilities import make_request result = make_request(method='get', path='/v1/coupons') pprint(result)
/v1/coupons
List Coupons
curl -X get https://sandboxapi.rapyd.net/v1/coupons?limit=2 -H 'access_key: your-access-key-here' -H 'Content-Type: application/json' -H 'salt: your-random-string-here' -H 'signature: your-calculated-signature-here' -H 'timestamp: your-unix-timestamp-here'
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "5f7419c1-298e-48f2-ab73-220975881c90" }, "data": [ { "id": "coupon_4ab30530e8a7352ffe715deecfab57b9", "amount_off": 2, "created": 1646825743, "currency": "USD", "duration": "forever", "duration_in_months": 0, "max_redemptions": 1, "metadata": { "merchant_defined": true }, "percent_off": 0, "redeem_by": 0, "times_redeemed": 0, "discount_valid_until": 0, "discount_validity_in_months": 0, "discount_duration_in_uses": 0, "description": "", "valid": true }, { "id": "coupon_71ac2a65139aced4ef0d09aec75e19ba", "amount_off": 0, "created": 1646825405, "currency": "USD", "duration": "repeating", "duration_in_months": 5, "max_redemptions": 0, "metadata": { "merchant_defined": true }, "percent_off": 20, "redeem_by": 0, "times_redeemed": 0, "discount_valid_until": 0, "discount_validity_in_months": 0, "discount_duration_in_uses": 0, "description": "", "valid": false } ] }