[#779] Gift cards - Promotions

Migrated from Redmine #779 | Author: Konstantinos Kontras
Status: Feedback | Priority: Normal | Created: 2021-09-10


Hi,

I would like to create through the API a giftcard that can be used once. I tried to locate such a functionality in the API but I couldnt find it. Could you please indicate if there is such possibility and how?

Thanks

Konstantinos Kontras wrote:

Sorry this is not a bug, I should have changed it!

Dmytro Bondarev wrote:

Hi,
You can generate code for existing gift card, that can be used only once: Документація API | SimplyBook.me Онлайн Бронювання

Konstantinos Kontras wrote:

Dmitry Bondarev wrote:

Hi,
You can generate code for existing gift card, that can be used only once: Документація API | SimplyBook.me Онлайн Бронювання

I tried to find this using the admin client but it seems that there is no functionality issuegiftcard or sth close to that. Mostly what I can see around promotions are these:

getPromotionList: [Function: method],
savePromotionDetails: [Function: method],
setPromotionEvents: [Function: method],
setPromotionMemberships: [Function: method],
setPromotionProducts: [Function: method],
setPromotionPaidAttributes: [Function: method],
deletePromotions: [Function: method],
setPromotionsPositions: [Function: method],
setPromotionsVisibility: [Function: method],
getPromotionInstanceReport: [Function: method],
getPromotionInstanceList: [Function: method],
getPromotionInstance: [Function: method],
getPromotionDetails: [Function: method],
deletePromotionInstances: [Function: method],
disabledPromotionInstances: [Function: method],
savePromotionInstance: [Function: method],
sendPromotionInstanceMessages: [Function: method],
applyPromoCode: [Function: method],
getPluginPromoInfoByCode: [Function: method],

Dmytro Bondarev wrote:

You can use REST API to issue gift cards.

Konstantinos Kontras wrote:

Isnt there any way to do it with the RPC client? I can see some functionalities such as saveAndSendGiftCards function. The problem is that they do not appear in the documentation

Dmytro Bondarev wrote:

It is internal API and can be changed at any time.
We do not have public documentation for theme methods.

Konstantinos Kontras wrote:

I undestand this, I will go with the rest API. Could you assist me on that request

I do the following:

                 const options = {
                      hostname: 'https://user-api-v2.simplybook.me/admin/promotions/issue-gift-card',
                      port: 443,
                      method: 'POST',
                      headers: {
                        'X-Company-Login': company_name ,
                        'X-User-Token': token,
                      }
                    }

and I get the following response.

Error: getaddrinfo ENOTFOUND https://user-api-v2.simplybook.me/admin/promotions/issue-gift-card
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26) {
errno: -3008,
code: ‘ENOTFOUND’,
syscall: ‘getaddrinfo’,
hostname: ‘https://user-api-v2.simplybook.me/admin/promotions/issue-gift-card
}

I saw that the promotion code I use is fine and data I am sending are correct, based on the API explorer. I assume it has to be the port. Could you indicate which one I should use?

Dmytro Bondarev wrote:

hostname is user-api-v2.simplybook.me
it seems you need to pass url in different param.