GiftCertificate resource (Shop API 20.9)

Summary

Http Method Resource Description
POST /gift_certificate Action to retrieve an existing gift certificate.

Get Gift Certificate

Action to retrieve an existing gift certificate.

Url

POST https://hostname:port/dw/shop/v20_9/gift_certificate

Formats

json, xml

Authentication

Name Description
JWT Authentication via Customer JWT.
OAuth Authentication via OAuth token. A valid user is required.

Request Document

GiftCertificateRequest

Response Document

GiftCertificate

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
404 GiftCertificateNotFoundException   Thrown if the given gift certificate code is not valid.

Customization

This Resource supports server-side customization.

Extension Point Method Detail
dw.ocapi.shop.gift_certificate.beforePOST

beforePOST (giftCertificateRequest : GiftCertificateRequest ) : Status

The function is called before the request will be processed.

Parameters:
giftCertificateRequest - The request containing the gift certificate code.
Returns:
a non-null Status ends the hook execution
dw.ocapi.shop.gift_certificate.modifyPOSTResponse

modifyPOSTResponse (giftCertificate : GiftCertificate , giftCertificateResponse : GiftCertificate ) : Status

Parameters:
giftCertificate - the target gift certificate
giftCertificateResponse - gift certificate response object
Returns:
a non-null Status ends the hook execution

Sample

REQUEST:
POST /dw/shop/v20_9/gift_certificate HTTP/1.1
Host: example.com
Accept: application/json
{
    gift_certificate_code:"123456789012"
}

# in case of success:

RESPONSE:
HTTP/1.1 200 OK
Content-Length: 303
Content-Type: application/json; charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
   "_v" : "20.9",
   "_type" : "gift_certificate",
   "balance" : 30.00,
   "description" : "Enabled gift certificate",
   "enabled" : true,
   "masked_gift_certificate_code" : "********9012",
   "merchant_id" : "00000001",
   "message" : "...",
   "recipient_email" : "[email protected]",
   "recipient_name" : "Joe Doe",
   "status" : "pending"
}


# in case of failure:

HTTP/1.1 404 NOT FOUND
Cache-Control: no-cache,no-store,must-revalidate
Expires: Thu, 01-Jan-1970 00:00:00 GMT
{
   "_v" : "20.9",
   "fault" : 
   {
      "type" : "NotFoundException",
      "message" : "The gift certificate with the provided code could not be retrieved."
   }
}
OCAPI obsolete versions 13.x and 14.x will be end of life in 2020 and versions 15.x and 16.x in 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.
X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.