Search API
Retrieve the results of searches across various scopes
of data. See Search Query and Filters for supported scopes. Search results are delivered in reverse chronological order by default.
Attributes
Name | Type | Description |
---|---|---|
object | string | The string |
location | string | API path to retrieve the current |
aggregate_level | integer | Aggregate Level up to which to fetch sub-merchants from the merchant hierarchy. For example, when set to 1, fetch sub-merchants 1 level under the master merchant. When set to 2, fetch sub-merchants from levels 1 and 2 under the master merchant, and so on. |
data | array | Paginated search results. |
export | object_id_expandable | The export identifier matching |
filters | object | Search filters (see search query and filters). |
order | string | Search results order. |
page | integer | Page for paginated results. |
per_page | integer | Records per page for paginated results. |
query | string | Search query (see search query and filters). |
scope | string | Search scope (type of data searched). See available scopes in Search Query and Filters |
total | integer | Number of records returned. |
total_pages | integer | Number of pages of records returned. |
Example
-
JSON Response
{ "object": "search", "export": null, "data": [ { "object": "transfer", "id": "trsf_test_no1t4tnemucod0e51mo", "livemode": false, "location": "/transfers/trsf_test_no1t4tnemucod0e51mo", "fail_fast": false, "paid": false, "sent": false, "sendable": true, "currency": "thb", "amount": 47448, "fee": 3000, "metadata": {}, "recipient": "recp_test_no1t4tnemucod0e51mo", "transaction": null, "schedule": null, "bank_account": { "object": "bank_account", "account_type": null, "bank_code": null, "branch_code": null, "brand": "test", "created": "2019-12-31T12:59:59Z", "last_digits": "6789", "name": "DEFAULT BANK ACCOUNT" }, "failure_code": null, "failure_message": null, "created": "2019-12-31T12:59:59Z", "paid_at": null, "sent_at": null } ], "page": 1, "per_page": 1, "total": 2, "total_pages": 2, "filters": {}, "location": "/search", "order": "reverse_chronological", "query": "", "scope": "transfer" }
Search
- GET https://api.omise.co/searchSearches a scope
of data based on input parameters. Note: the pagination mechanism for search results is different from that for lists. Use page
and per_page
instead of offset
and limit
.
Request Parameters
Name | Type | Description |
---|---|---|
scope | string | (required, one of: |
filters | object | (optional) Search filters (see search query and filters). |
order | string | (optional, default: |
page | integer | (optional, default: |
per_page | integer | (optional, default: |
query | string | (optional) Search query (see search query and filters). |
Example
-
Search using query and filters
- curl
- php
- ruby
- C#
- python
- go
- elixir
curl https://api.omise.co/search \ -X GET \ -u $OMISE_SECRET_KEY: \ -d "scope=charge" \ -d "filters[created]=2019/01/01..2019/12/31"
<?php require './omise-php/lib/Omise.php'; define('OMISE_SECRET_KEY', 'skey_test_51fl8dfabe7sqnj8th2'); $search = OmiseCharge::search('query string (can be empty)')->filter(array( 'captured' => true, 'created' => "today", )); print_r($search['data']);
require "omise" Omise.secret_api_key = "skey_test_4xs8breq3htbkj03d2x" # You can use the search scope on classes which provides it. The SearchScope # provides a chainable interface which is very similar to what ActiveRecord # provides in rails. search = Omise::Charge.search.filter(paid: true, created: "today").execute # Or you can use the Search class directly. search = Omise::Search.execute({ scope: "charge", filters: { captured: true, created: "today", }, })
var charges = await Client.Charges.Search( query: "TSUNAMI", order: Ordering.ReverseChronological ); Console.WriteLine($"total tsunami charges: {charges.Total}");
import omise omise.api_secret = "skey_test_no1t4tnemucod0e51mo" search = omise.Search.execute( "charge", **{"query": "thb", "filters": {"amount": "1000..2000", "captured": "true"}} )
client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.ChargeSearchResult{} err := client.Do(result, &operations.Search{ Scope: omise.ChargeScope, Query: "John", Filters: map[string]string{ "created": "2016-08-01..2024-08-30", "captured": "true", }, }) if err != nil { log.Fatalln(err) } log.Println(result)
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Charge.search( filters: [ paid: true, created: "today" ] ) # Or you can use the Search module directly. Omise.Search.execute("charge", filters: [ paid: true, created: "today" ] )