[#799] Questions about promotion instance details

Migrated from Redmine #799 | Author: Antonio Graterol
Status: Feedback | Priority: Normal | Created: 2021-10-08


Hi you Guys, recently I did a query related to get the connection between a coupon title and its invoices, thanks to you it worked like a charm.

Following that thread, this time I need to get the data that appears inside the red rectangle of this image (https://ibb.co/HpTF1Gw), I already know that some of them can be fetched using ‘https://user-api-v2.simplybook.me/admin/promotions’ but I can relate only a few of them and I’m not really sure of what I’m getting.

Next, I’ll show a comparison from what I’m looking for and what I get from API call
Simplybook interface | API Call’s JSON object

  • Code | Not found
  • Usage limit | seems to be represented by this attribute - “is_unlimited”: true
  • Valid From - To | Not found
  • Discount | Found - “discount”: 100.0
  • Used discount | Not found

The requests:

  1. I want to confirm if the “is_unlimited” attribute coming from the API call is the same value as Usage limit from the web interface
  2. How or where do I get the rest of the parameters?

Dmytro Bondarev wrote:

Hi,
It seems you need to use API documentation | SimplyBook.me Online Scheduling and API documentation | SimplyBook.me Online Scheduling
Because promotions list is like template, not instance it self.

Antonio Graterol wrote:

Thanks for your time Dmitry. I’ll give a check a I’ll come back to you if need.

Be safe :slight_smile:

Dmitry Bondarev wrote:

Hi,
It seems you need to use API documentation | SimplyBook.me Online Scheduling and API documentation | SimplyBook.me Online Scheduling
Because promotions list is like template, not instance it self.

Antonio Graterol wrote:

Hi Dmitry, I still not getting anything, most of all I need the code, which is called in UI jargon “Redeemable Code”. Looking at the links you’ve sent they have the same URL structure, though I did try with both even with no filters and retrieved empty objects…

Get gift cards list’s HTTP Request example:
GET https://user-api-v2.simplybook.me/admin/promotions/gift-cards?filter[start_date_from]=2021-08-30&filter[status]=active&filter[service_id]=1

Get coupons list’s HTTP Request example:
GET https://user-api-v2.simplybook.me/admin/promotions/gift-cards?filter[start_date_from]=2021-08-30&filter[status]=active&filter[service_id]=1

I also tried with some filter but I’m still getting the same

In the ‘empty response.png’ you can what I get.

In the ‘redeembale code.png’ you can see what I’m looking for

Thanks in advance,
Antonio

Antonio Graterol wrote:

Thanks for your time Dmitry. I’ll give a check a I’ll come back to you if need.

Be safe :slight_smile:

Dmitry Bondarev wrote:

Hi,
It seems you need to use API documentation | SimplyBook.me Online Scheduling and API documentation | SimplyBook.me Online Scheduling
Because promotions list is like template, not instance it self.

Dmytro Bondarev wrote:

Hi, sorry i noticed error in documentation. We will fix it. For a while please try following endpoint:

GET https://user-api-v2.simplybook.me/admin/promotions/coupons?filter[start_date_from]=2021-08-30&filter[status]=active
Content-Type: application/json
X-Company-Login: {{ company }}
X-Token: {{ token }}

Antonio Graterol wrote:

Hi Dmitry, that worked like a charm. Thanks again for your help :slight_smile:

Dmitry Bondarev wrote:

Hi, sorry i noticed error in documentation. We will fix it. For a while please try following endpoint:

[…]