This is a quick guide on how to use ONIGI API Service. Please make note that the API URL we’re using on the examples below is the Development (Sandbox) environment URL. We will provide the production URL afterwards after your system is available for production.
API call requires credentials as follows:
Onigi API Secret → API Secret specially used for Onigi
API call will return using a number of different response objects. Each of these objects attempts to model the data in a manner that is easy-to-understand while also representative of the natural relationships between properties. Responses are available in JSON format.
Below is the basic workflow of how ONIGI API works.
The PHP SDK provides a rich set of server-side functionality for accessing Onigi’s server-side API calls.
You can download the Onigi PHP SDK from GitHub https://github.com/onigi/api-php
The PHP SDK is typically used to perform operations as an app administrator, but can also be used to perform operations on behalf of the current session user. By removing the need to manage access tokens manually, the PHP SDK greatly simplifies the process of authentication and authorizing users for your app.
You will need an app id to initialize the SDK, which you can obtain from the Developer App.
To install the PHP SDK, extract the downloaded files and copy the files from the src/ directory to a directory on the server where you will host your app, for example php-sdk. Then, just include php-sdk/onigi.php wherever you want to use the SDK. You use the SDK by instantiating a new Onigi object with, at a minimum, your app id and app secret:
require_once("onigi.php"); $config = array(); $config[‘appId’] = 'YOUR_APP_ID'; $config[‘secret’] = 'YOUR_APP_SECRET'; $onigi = new Onigi($config);
The PHP SDK can be used to support registration and login to your site using the users Onigi account. On the server-side, the PHP SDK provides helper-methods to simply login, request permissions, and logout. This functionality is provided by the Onigi::getUser() methods.
This method allows Onigi to load store info.
Example Request
/me.format
https://market.onigi.com/api/me.json?access_token={access_token}&method=GET
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | GET | Yes |
Example Result:
{
"store_id":"12345",
"store_name":"My Store",
"description":"Selling Any Item On Facebook",
"signature":"Thank you for purchasing from My Store",
"contact_name":"White Austin",
"contact_email":"w.austin@anydomain.com",
"company":"PT My Store",
"address":"Jl. Satu Gang",
"city":"Jakarta",
"region":"DKI Jakarta",
"country":"Indonesia",
"zip_code":"12345",
"phone":"021-1234545",
"fax":"",
"mobile":"",
"facebook":"12345678",
"twitter":null
}
This method allows Onigi to load list orders.
Example Request
/orders.format
https://market.onigi.com/api/orders.json?access_token={access_token}&method=GET&payment=paid
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | GET | Yes |
| Id | Integer | Optional |
| Page | Integer | Optional |
| Limit | Integer | Optional |
| Search | String | Optional |
| Payment | Paid/unpaid | Optional |
| Order_status | process/accept/pending/cancel/shipped | optional |
Example Result:
{
"list":[
{
"id":"1266",
"reference_no":"11898.12305.1266.20120216",
"order_status":"accept",
"purchase_date":"2012-02-16 07:19:25",
"voucher_code":"valentine",
"order_note":"",
"subtotal_price":1062400,
"discount":10000,
"tax_fee":"0.000",
"extra_fee":"0.00",
"total_price":"1065400.00",
"extra_order":false,
"share_to_fb":true,
"customer":{
"email":"jhonny@funny.com",
"firstname":"Jhonny",
"lastname":"Funny"
},
"shipping":{
"name":"JNE (YES)",
"price":"13000.00"
},
"payment":{
"status":"paid",
"payment_method":"Bank Transfer",
"transaction_number":null,
"payer":null,
"receiver":null
},
"billing_address":{
"firstname":"Jhonny",
"lastname":"Funny",
"street":"hello",
"street2":"",
"city_name":"Jakarta",
"region_name":"DKI Jakarta",
"country_name":"Indonesia",
"postcode":"12345",
"city":"4010",
"region":"2145",
"country":"114",
"email":"jhonny@funny.com",
"telephone":"12345"
},
"shipping_address":{
"firstname":"Jhonny",
"lastname":"Funny",
"street":"hello",
"street2":"",
"city_name":"Jakarta",
"region_name":"DKI Jakarta",
"country_name":"Indonesia",
"postcode":"12345",
"city":"4010",
"region":"2145",
"country":"114",
"email":"jhonny@funny.com",
"telephone":"12345"
},
"products":[
{
"id":"1785",
"name":"Bamboo Charcoal Tee Running T-Shirt",
"description":"Ukuran:XL",
"original_price":"128000.00",
"price":"89600.00",
"discount":38400,
"quantity":"1",
"subtotal":89600
},
{
"id":"1786",
"name":"Bamboo Charcoal Tee Running T-Shirt",
"description":"Ukuran:L",
"original_price":"127000.00",
"price":"88900.00",
"discount":38100,
"quantity":"2",
"subtotal":177800
},
{
"id":"1787",
"name":"T-Shirt Adidas HQ",
"description":"",
"original_price":"265000.00",
"price":"265000.00",
"discount":0,
"quantity":"3",
"subtotal":795000
}
]
},
{
"id":"1265",
"reference_no":"11898.12305.1265.20120215",
"order_status":"pending",
"purchase_date":"2012-02-15 11:11:52",
"voucher_code":"valentine",
"order_note":"",
"subtotal_price":175000,
"discount":10000,
"tax_fee":"0.000",
"extra_fee":"0.00",
"total_price":"186000.00",
"extra_order":false,
"share_to_fb":true,
"customer":{
"email":"jhonny@funny.com",
"firstname":"Jhonny",
"lastname":"Funny"
},
"shipping":{
"name":"TIKI (HDS)",
"price":"21000.00"
},
"payment":{
"status":"unpaid",
"payment_method":"Bank Transfer",
"transaction_number":null,
"payer":null,
"receiver":null
},
"billing_address":{
"firstname":"Jhonny",
"lastname":"Funny",
"street":"hello",
"street2":"",
"city_name":"Jakarta",
"region_name":"DKI Jakarta",
"country_name":"Indonesia",
"postcode":"12345",
"city":"4010",
"region":"2145",
"country":"114",
"email":"jhonny@funny.com",
"telephone":"12345"
},
"shipping_address":{
"firstname":"Jhonny",
"lastname":"Funny",
"street":"hello",
"street2":"",
"city_name":"Jakarta",
"region_name":"DKI Jakarta",
"country_name":"Indonesia",
"postcode":"12345",
"city":"4010",
"region":"2145",
"country":"114",
"email":"jhonny@funny.com",
"telephone":"12345"
},
"products":[
{
"id":"1784",
"name":"Bamboo Charcoal Tee Running T-Shirt",
"description":"",
"original_price":"125000.00",
"price":"87500.00",
"discount":37500,
"quantity":"2",
"subtotal":175000
}
]
}
],
"total":2
}
This method allows Onigi to accept order.
Example Request
/orders/accept/:order_id.format
https://market.onigi.com/api/orders/accept/1226.json?access_token={access_token}&method=POST
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | POST | Yes |
Example Result:
{
"id" => 1266
"errors" => array
(
)
}
This method allows Onigi to set order in process.
Example Request
/orders/process/:order_id.format
https://market.onigi.com/api/orders/process/1226.json?access_token={access_token}&method=POST
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | POST | Yes |
Example Result:
{
"id" => 1266
"errors" => array
(
)
}
This method allows Onigi to cancel order.
Example Request
/orders/cancel/:order_id.format
https://market.onigi.com/api/orders/cancel/1226.json?access_token={access_token}&method=POST
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | POST | Yes |
Example Result:
{
"id" => 1266
"errors" => array
(
)
}
This method allows Onigi to set an order as Pending.
Example Request
/orders/pending/:order_id.format
https://market.onigi.com/api/orders/pending/1226.json?access_token={access_token}&method=POST
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | POST | Yes |
Example Result:
{
"id" => 1266
"errors" => array
(
)
}
This method allows Onigi to set as shipped order
Example Request
/orders/shipped/:order_id.format
https://market.onigi.com/api/orders/shipped/1226.json?access_token={access_token}&method=POST
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | POST | Yes |
Example Result:
{
"id" => 1266
"errors" => array
(
)
}
This method allows Onigi to load list products
Example Request
/products.format
https://market.onigi.com/api/products.json?access_token={access_token}&method=GET&payment=paid&page=1&limit=1
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | GET | Yes |
| Id | Integer | Optional |
| Categories | Comma separated integer | Optional |
| Page | Integer | Optional |
| Limit | Integer | Optional |
| Search | string | Optional |
| With_images | boolean (true/false) | Optional |
| With_details | boolean (true/false) | Optional |
| With_variations | boolean (true/false) | Optional |
Example Result:
{
"list":[
{
"id":"5745",
"sku":"AB24566",
"handle":"t-shirt-adidas-hq",
"title":"T-Shirt Adidas HQ",
"description":null,
"in_stock":true,
"price":"265000.00",
"price_display":"265.000,00 IDR",
"has_discount":false,
"video_script":null,
"created_at":"2012-02-09 15:35:37",
"modified_at":"2012-02-09 15:36:06",
"fb_link":"https:\/\/dev.onigi.com\/product\/detail\/id\/5745\/route\/fb_page",
"categories":[
{
"id":"14423",
"name":"Others"
}
]
},
{
"id":"5746",
"sku":"AC34556",
"handle":"",
"title":"T-Shirt Adidas Fevernova",
"description":null,
"in_stock":true,
"price":"270000.00",
"price_display":"270.000,00 IDR",
"has_discount":false,
"video_script":null,
"created_at":"2012-02-08 12:12:42",
"modified_at":"2012-02-08 12:12:42",
"fb_link":"https:\/\/dev.onigi.com\/product\/detail\/id\/5746\/route\/fb_page",
"categories":[
{
"id":"14423",
"name":"Others"
}
]
},
{
"id":"5749",
"sku":"SK123456",
"handle":"bamboo-charcoal-tee-running-t-shirt",
"title":"Bamboo Charcoal Tee Running T-Shirt",
"description":null,
"in_stock":true,
"price":"125000.00",
"price_display":"125.000,00 IDR",
"has_discount":true,
"video_script":null,
"created_at":"2012-02-15 16:54:39",
"modified_at":"2012-02-15 16:54:41",
"fb_link":"https:\/\/dev.onigi.com\/product\/detail\/id\/5749\/route\/fb_page",
"categories":[
{
"id":"14424",
"name":"Featured"
}
],
"discount":87500,
"discount_display":"87.500,00 IDR",
"discount_start":"2012-02-10 00:00:00",
"discount_end":"2012-02-29 00:00:00",
"is_daily_deal":false,
"daily_deal_start":"2012-02-10 00:00:00",
"daily_deal_end":"2012-02-29 00:00:00"
}
],
"total":3
}
This method allows Onigi to display specific Product
Example Request
/products/:product_id.format
https://market.onigi.com/api/products/5475.json?access_token={access_token}&method=GET
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | POST | Yes |
Example Result:
{
"id":"5745",
"sku":"AB24566",
"handle":"t-shirt-adidas-hq",
"title":"T-Shirt Adidas HQ",
"description":null,
"in_stock":true,
"price":"265000.00",
"price_display":"265.000,00 IDR",
"has_discount":false,
"video_script":null,
"created_at":"2012-02-09 15:35:37",
"modified_at":"2012-02-09 15:36:06",
"fb_link":"https:\/\/dev.onigi.com\/product\/detail\/id\/5745\/route\/fb_page",
"categories":[
{
"id":"14423",
"name":"Others"
}
],
"images":{
"main":{
"id":"20501",
"size_117_117":"https:\/\/dev.onigi.com\/static\/2\/images\/products\/5745\/8f85af784feec4e16f6dc9efce67d9f0_117_117.jpg",
"size_160_160":"https:\/\/dev.onigi.com\/static\/2\/images\/products\/5745\/8f85af784feec4e16f6dc9efce67d9f0_160_160.jpg",
"size_230_230":"https:\/\/dev.onigi.com\/static\/2\/images\/products\/5745\/8f85af784feec4e16f6dc9efce67d9f0_230_230.jpg",
"size_105_105":"https:\/\/dev.onigi.com\/static\/2\/images\/products\/5745\/8f85af784feec4e16f6dc9efce67d9f0_105_105.jpg",
"size_60_60":"https:\/\/dev.onigi.com\/static\/2\/images\/products\/5745\/8f85af784feec4e16f6dc9efce67d9f0_60_60.jpg",
"size_500_500":"https:\/\/dev.onigi.com\/static\/2\/images\/products\/5745\/8f85af784feec4e16f6dc9efce67d9f0_500_500.jpg"
},
"others":[
{
"id":"20502",
"size_160_160":"https:\/\/dev.onigi.com\/static\/2\/images\/products\/5745\/1295bf1cd5838df47481fe11a995a347.jpg",
"size_60_60":"https:\/\/dev.onigi.com\/static\/2\/images\/products\/5745\/1295bf1cd5838df47481fe11a995a347.jpg",
"size_500_500":"https:\/\/dev.onigi.com\/static\/2\/images\/products\/5745\/1295bf1cd5838df47481fe11a995a347.jpg"
},
{
"id":"20503",
"size_160_160":"https:\/\/dev.onigi.com\/static\/2\/images\/products\/5745\/1866a56faf8d89d2a25d164b6485ee69.jpg",
"size_60_60":"https:\/\/dev.onigi.com\/static\/2\/images\/products\/5745\/1866a56faf8d89d2a25d164b6485ee69.jpg",
"size_500_500":"https:\/\/dev.onigi.com\/static\/2\/images\/products\/5745\/1866a56faf8d89d2a25d164b6485ee69.jpg"
},
{
"id":"20504",
"size_160_160":"https:\/\/dev.onigi.com\/static\/2\/images\/products\/5745\/ea913d43081964ff91b5c2253c4943b4.jpg",
"size_60_60":"https:\/\/dev.onigi.com\/static\/2\/images\/products\/5745\/ea913d43081964ff91b5c2253c4943b4.jpg",
"size_500_500":"https:\/\/dev.onigi.com\/static\/2\/images\/products\/5745\/ea913d43081964ff91b5c2253c4943b4.jpg"
}
]
},
"details":[
],
"variants":null,
"variant_combinations":[
]
}
This method allows Onigi to delete Product
Example Request
/products/delete/:product_id.format
https://market.onigi.com/api/products/delete/1266.json?access_token={access_token}&method=POST
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | POST | Yes |
Example Result:
{
"id" => 1266
"errors" => array
(
)
}
This method allows Onigi to load list Categories
Example Request
/categories.format
https://market.onigi.com/api/categories.json?access_token={access_token}&method=GET
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | POST | Yes |
| Id | Integer | |
| Page | Integer | |
| Limit | Integer | |
| search | String | |
| Parent_id | Integer |
Example Result:
{
"list":[
{
"id":"14423",
"parent_id":"0",
"name":"Others",
"description":"Others Category"
},
{
"id":"14424",
"parent_id":"0",
"name":"Featured",
"description":"Featured Category"
},
{
"id":"14744",
"parent_id":"0",
"name":"Kategori Baru",
"description":"Deskripsi Kategori Baru"
},
{
"id":"14747",
"parent_id":"14744",
"name":"Pilihan",
"description":"Kategori Pilihan"
}
],
"total":4
}
This method allows Onigi to display specific Category
Example Request
/categories/:category_id.format
https://market.onigi.com/api/categories/14423.json?access_token={access_token}&method=GET
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | POST | Yes |
Example Result:
{
"id":"14423",
"parent_id":"0",
"name":"Others",
"description":"Others Category"
}
This method allows Onigi to create new Category
Example Request
/categories.format
https://market.onigi.com/api/categories.json?access_token={access_token}&method=POST&name=Diskonan&description=Barang%20diskon
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | POST | Yes |
| Name | String | Yes |
| Description | String | Yes |
| Parent_id | Integer | No |
Example Result:
{
"id":"14423",
"errors":null
}
This method allows Onigi to modify a Category
Example Request
/categories/:category_id.format
https://market.onigi.com/api/categories/14423.json?access_token={access_token}&method=POST&name=Clothes
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | POST | Yes |
| Name | String | Yes |
| Description | String | Yes |
| Parent_id | Integer | No |
Example Result:
{
"id":"14423",
"errors":null
}
This method allows Onigi to delete a Category
Example Request
/categories/delete/:category_id.format
https://market.onigi.com/api/categories/delete/14423.json?access_token={access_token}&method=POST
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | POST | Yes |
Example Result:
{
"id" => 14423
"errors" => array
(
)
}
This method allows Onigi to get list of variations
Example Request
/variants.format
https://market.onigi.com/api/variants.json?access_token={access_token}&method=GET
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | POST | Yes |
Example Result:
{
"list":[
{
"values":[
{
"id":"1155",
"identifier":"xl",
"name":"XL"
},
{
"id":"1156",
"identifier":"l",
"name":"L"
},
{
"id":"1157",
"identifier":"m",
"name":"M"
},
{
"id":"1158",
"identifier":"s",
"name":"S"
}
],
"id":"14745",
"name":"Ukuran",
"description":""
},
{
"values":[
{
"id":"1159",
"identifier":"merah",
"name":"Merah"
},
{
"id":"1160",
"identifier":"kuning",
"name":"Kuning"
},
{
"id":"1161",
"identifier":"hijau",
"name":"Hijau"
},
{
"id":"1162",
"identifier":"biru",
"name":"Biru"
},
{
"id":"1163",
"identifier":"putih",
"name":"Putih"
},
{
"id":"1164",
"identifier":"hitam",
"name":"Hitam"
}
],
"id":"14748",
"name":"Warna",
"description":"Warna Baju"
}
],
"total":2
}
This method allows Onigi to view a variation details
Example Request
/variants/:variant_id.format
https://market.onigi.com/api/variants/14745.json?access_token={access_token}&method=GET
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | POST | Yes |
Example Result:
{
"id":"14745",
"name":"Ukuran",
"description":"",
"values":[
{
"id":"1155",
"identifier":"xl",
"name":"XL"
},
{
"id":"1156",
"identifier":"l",
"name":"L"
},
{
"id":"1157",
"identifier":"m",
"name":"M"
},
{
"id":"1158",
"identifier":"s",
"name":"S"
}
]
}
This method allows Onigi to create variation
Example Request
/variants.format
https://market.onigi.com/api/variants.json?access_token={access_token}&method=POST&title=Warna&description=Warna%20Product&values=[{"title":"Putih"},{"title":"Merah"},{"title":"Kuning"},{"title":"Hijau"}]
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | POST | Yes |
| Title | String | Yes |
| Description | String | No |
| Values | Json | Yes |
Example Result:
{
“id”:”14755”,
“errors”:null
}
This method allows Onigi to update variation details
Example Request
/variants/:variant_id.format
https://market.onigi.com/api/variants/14755.json?access_token={access_token}&method=POST&title=Warna&description=Warna%20Product&values=[{“id”:1377,”title”:”Putih”},{“id”:1378,”title”:”Merah”},{“id”:1379,”title”:”Kuning”},{“id”:1380,”title”:”Hijau”}]
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | POST | Yes |
| Title | String | Yes |
| Description | String | No |
| Values | Json | Yes |
Example Result:
{
“id”:”14755”,
“errors”:null
}
This method allows Onigi to delete variation
Example Request
/variants/delete/:variant_id.format
https://market.onigi.com/api/variants/delete/14745.json?access_token={access_token}&method=POST
Parameters
| Name | Data Type | Required |
|---|---|---|
| access_token | String | Yes |
| method | POST | Yes |
Example Result:
{
"id" => 14423
"errors" => array
(
)
}