0

I want to get all coupons that i created in the price rule section using the API just like the result of product/orders listing API.

2 Answers 2

0

You can use GET on "/V1/coupons/search"

4
  • What should be the search criteria?
    – Deepak Dev
    Commented Jul 29, 2020 at 12:50
  • Depends on what you are searching for. if you want to get "all" as you stated in the question, you don't need a search criteria Commented Jul 29, 2020 at 13:25
  • But when I tried this without any search criteria, I get missing filename error.
    – Deepak Dev
    Commented Jul 29, 2020 at 13:27
  • I have found the answer : rest/V1/coupons/search?searchCriteria=all From the above API, i got all the coupon codes, then i picked the rule_id which is 5 and put in the below API for getting details of that particular API /rest/V1/salesRules/5
    – Deepak Dev
    Commented Aug 3, 2020 at 11:59
0

Yes we can use the following to get all the coupon codes via REST API.


GET     -   {{url_rest_api}}/rest/V1/coupons/search?searchCriteria=all      
Auth    -   Bearer Token = ###

Body    -     Blank 

Response
{
    "items": [
        {
            "coupon_id": 2,
            "rule_id": 5,
            "code": "TEST123",
            "times_used": 0,
            "is_primary": true,
            "type": 0
        }
    ],
    "search_criteria": {
        "filter_groups": []
    },
    "total_count": 1
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.