GiftCertificate resource (Shop API 19.3)

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/v19_3/gift_certificate

Formats

json, xml

Authentication

Name Description
JWT Authentication via Customer JWT token.
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/v19_3/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" : "19.3",
   "_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" : "19.3",
   "fault" : 
   {
      "type" : "NotFoundException",
      "message" : "The gift certificate with the provided code could not be retrieved."
   }
}