Secure Payments API Search

General

You also have the option to export a search through the API.

Secure Payments (formerly PCI Wallet) provides comprehensive searching capabilities so you can find exactly the data you need to build reports. Searching is done through a single endpoint  POST search.

Searching is provided by  ElasticSearch and it has its own domain-specific language to specify search parameters. Please refer to their documentation to know all the options available for search.

POST search/{type}

Searching is done by the type of entity you are interested in:

  • transaction
  • customer
  • import
  • note
  • customer
  • billing-history
  • usage-history

The most basic query is to simply get all results:

Request:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'secret: your-secret' --header 'authorization: your-token' -d '{"search": {"query": {"match_all": {}}}}' 'https://pciwallet.simnang.com/api/search/transaction?export=false'

Response:

{
"result": {
"took": 92,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "5_1459192127767",
"_type": "transaction",
"_id": "59",
"_score": 1,
"_source": {
"customer_primary_address2": "",
"customer_mail_country": "",
"amount": 10,
"transaction_id": "59",
"customer_primary_address1": "",
"account_accountholder_name": "",
"customer_primary_city": "",
"customer_mail_state": "",
"account_address_id": 22,
"processor_name": "test nacha",
"customer_credit_limit": 0,
"customer_contact_name": "",
"raw_response": "{}",
"account_id": 9,
"account_eft_branch_number": "",
"account_state": "AZ",
"customer_middle_name": "",
"customer_mail_address2": "",
"operation": "void",
"customer_ssn": "123456789",
"operation_success": true,
"customer_email": "sample@customer.com",
"type": "eCheck/ACH",
"created": "2016-3-23 16:11:37",
"account_user_id": 5,
"account_city": "Nogales",
"customer_mail_city": "",
"account_zipcode": "85621",
"customer_primary_state": "",
"customer_gender": "male",
"customer_last_name": "Doe",
"account_routing_number": "021000021",
"customer_mail_zipcode": "",
"customer_generation_code": "none",
"customer_company_name": "",
"account_bank_name": "Banky McBank",
"status": "submitted",
"customer_birthdate": "1982-09-19",
"id": 1,
"account_customer_id": 16,
"account_country": "USA",
"processor_id": 1,
"customer_primary_zipcode": "",
"customer_primary_address": null,
"customer_first_name": "John",
"account_updated": "2016-03-21T16:07:49Z",
"customer_mail_address1": "",
"customer_mail_address": null,
"sec_code": "PPD",
"account_address": "1200 W. Elm St.",
"customer_primary_country": "",
"raw_http_code": 200,
"processor": "nacha",
"account_account_number": "000111222",
"account_eft_institution_number": "",
"metadata": "{}",
"account_created": "2015-12-11T22:22:36Z",
"customer_name": "Sample Customer",
"customer_driver_license": "ADRIVER123",
"customer_id": 16
}
}
]
}
}
}

In this example, we only have a single transaction. For bigger result sets, the response is paginated to a maximum of 10 results by default. Pagination can be controlled by the from and  sort parameters. Also, the result set size can be controlled by the size parameter.

Request:

curl -X POST --header 'Content-Type: application/json' --header
'Accept: application/json' --header 'secret: yor-secret' --header
'authorization: your-token' -d '{"search": {"query": {"match_all":
{}}, "size": 1, "from": 2}}' 'https://pciwallet.simnang.com/api/search/import?export=false'

In the request above, a result set of size 1 is specified. So even if the search matches more elements, it will only return up to a maximum size of 1. From 2 is also specified, meaning it will return results starting with the element in position 2.

Sorting can be done by any field:

curl -X POST --header 'Content-Type: application/json' --header
'Accept: application/json' --header 'secret: yor-secret' --header
'authorization: your-token' -d '{"search": {"query": {"match_all":
{}}, "size": 1, "from": 2, "sort": [{"created": {"order": "asc"}}]}}' 'https://pciwallet.simnang.com/api/search/import?export=false'

Please refer to the  ElasticSearch documentation to learn more about the search domain-specific language.


How did we do?


Powered by HelpDocs (opens in a new tab)