GiftCertificateSearch resource (Data API 23.2)
Summary
Http Method | Resource | Description |
---|---|---|
POST | /sites/{site_id}/gift_certificate_search |
Searches for gift certificates. The query attribute specifies a complex query that can be used to narrow down the search. These are the list of searchable attributes:
* masked_gift_certificate_code, also known as just code, can only be used in a term query. If a four-character code is supplied, it is assumed that the search is on the unmasked portion of the code, otherwise the full code must be matched. Text queries are not allowed. * currency_mnemonic can only be joined with other attributes using a conjunction (AND). Note that only searchable attributes can be used in sorting. The code attribute cannot be used for sorting. |
Search GiftCertificates
Searches for gift certificates.
The query attribute specifies a complex query that can be used to narrow down the search. These are the list of searchable attributes:
- merchant_id - String
- masked_gift_certificate_code* - String
- order_no - String
- sender_name - String
- recipient_name - String
- recipient_email - String
- status - String
- enabled - Boolean
- message - String
- description - String
- creation_date - Date
- currency_mnemonic* - String
* masked_gift_certificate_code, also known as just code, can only be used in a term query. If a four-character code is supplied, it is assumed that the search is on the unmasked portion of the code, otherwise the full code must be matched. Text queries are not allowed.
* currency_mnemonic can only be joined with other attributes using a conjunction (AND).
Note that only searchable attributes can be used in sorting. The code attribute cannot be used for sorting.
Url
POST https://hostname:port/dw/data/v23_2/sites/{site_id}/gift_certificate_search
Formats
json, xml
Authentication
Name | Description |
---|---|
OAuth | Authentication via OAuth token. |
Request Document
Response Document
Path Parameters
Parameter | Type | Description | Constraints |
---|---|---|---|
site_id | String | The id of the site. | minLength=1 |
In case of a failure Fault Document is returned.
Faults
Status | Type | Arguments | Description |
---|---|---|---|
400 | MalformedSearchParameterException |
Thrown if the query is ill-formed. |
Sample
REQUEST:
POST /s/-/dw/data/v23_2/sites/SiteGenesis/gift_certificate_search HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Accept: application/json
{
"query" : {
"text_query": {
"fields": ["status"],
"search_phrase": "pending"
}
},
"select" : "(**)"
}
# in case of success:
RESPONSE:
HTTP/1.1 200 OK
Content-Length: 67
Content-Type: application/json; charset=UTF-8
{
"_v" : "23.2",
"_type" : "gift_certificate_search_result",
"count" : 3,
"hits" :
[
{
"_type" : "gift_certificate",
"_resource_state" : "860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5",
"amount" :
{
"_type" : "money",
"currency_mnemonic" : "USD",
"value" : 100.00
},
"balance" :
{
"_type" : "money",
"currency_mnemonic" : "USD",
"value" : 100.00
},
"creation_date" : "2015-07-31T15:10:25.192Z",
"description" : "description",
"enabled" : true,
"link" : "https://example.com/s/-/dw/data/v23_2/sites/SiteGenesis/gift_certificates/my-merchant_id",
"masked_gift_certificate_code" : "************HHHZ",
"merchant_id" : "my-merchant_id",
"order_no" : "00000001",
"status" : "pending",
"transactions" :
[
{
"_type" : "account_transaction",
"amount" :
{
"_type" : "money",
"currency_mnemonic" : "EUR",
"value" : 80.00
},
"order_no" : "00000001",
"timestamp" : "2015-01-09T17:16:12.066Z",
"type_code" : "create"
}
]
},
{
"_type" : "gift_certificate",
"_resource_state" : "43c2d7a118bd0a4034399ed86c86654b40c198ea64fd3195e5587d9211d10d7e",
"amount" :
{
"_type" : "money",
"currency_mnemonic" : "USD",
"value" : 100.00
},
"balance" :
{
"_type" : "money",
"currency_mnemonic" : "USD",
"value" : 100.00
},
"creation_date" : "2015-07-31T15:03:23.288Z",
"enabled" : true,
"link" : "https://example.com/s/-/dw/data/v23_2/sites/SiteGenesis/gift_certificates/my-merchant_id",
"masked_gift_certificate_code" : "************DOIZ",
"merchant_id" : "my-merchant_id",
"order_no" : "00000002",
"status" : "pending",
"transactions" :
[
{
"_type" : "account_transaction",
"amount" :
{
"_type" : "money",
"currency_mnemonic" : "EUR",
"value" : 80.00
},
"order_no" : "00000002",
"timestamp" : "2015-02-09T17:16:12.066Z",
"type_code" : "create"
}
]
},
{
"_type" : "gift_certificate",
"_resource_state" : "045f07bb655171dc37d8eb8bf4b0db7ac1fb3a160002eb96fbe6e2f95aa4b6cc",
"amount" :
{
"_type" : "money",
"currency_mnemonic" : "USD",
"value" : 100.00
},
"balance" :
{
"_type" : "money",
"currency_mnemonic" : "USD",
"value" : 100.00
},
"creation_date" : "2015-07-31T15:10:00.659Z",
"description" : "description",
"enabled" : true,
"link" : "https://example.com/s/-/dw/data/v23_2/sites/SiteGenesis/gift_certificates/my-merchant_id",
"masked_gift_certificate_code" : "************GSPZ",
"merchant_id" : "my-merchant_id",
"order_no" : "00000003",
"status" : "pending",
"transactions" :
[
{
"_type" : "account_transaction",
"amount" :
{
"_type" : "money",
"currency_mnemonic" : "EUR",
"value" : 80.00
},
"order_no" : "00000003",
"timestamp" : "2015-09-09T17:16:12.066Z",
"type_code" : "create"
}
]
}
],
"query" :
{
"text_query" :
{
"_type" : "text_query",
"fields" :
[
"status"
],
"search_phrase" : "pending"
}
},
"select" : "(**)",
"start" : 0,
"total" : 3
}
# in case of failure:
{
"query" : {
"text_query": {
"fields": ["link"],
"search_phrase": "my-link"
}
},
"select" : "(**)"
}
RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
"_v" : "23.2",
"fault" :
{
"type" : "UnqueryableFieldException",
"message" : "The field 'link' cannot be queried."
}
}