Request
Here are examples of how to send a Product fetch request to the OpenAPI system.
Sample fetch Product list request
curl -X POST \
{base-url}/api/v2/partner/products
-H 'Content-Type: application/json'
-H 'KEY: API Key'
-H 'TOKEN: token'
-H 'VERSION: 2.0'
-H 'accept: application/json'
-H 'cache-control: no-cache'
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "{base-url}/api/v2/partner/products"
method := "POST"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("KEY", "API Key")
req.Header.Add("TOKEN", "token")
req.Header.Add("VERSION", "2.0")
req.Header.Add("accept", "application/json")
req.Header.Add("cache-control", "no-cache")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '{base-url}/api/v2/partner/products',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'KEY: API Key',
'TOKEN: token',
'VERSION: 2.0',
'accept: application/json',
'cache-control: no-cache'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var settings = {
"url": "{base-url}/api/v2/partner/products",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"KEY": "API Key",
"TOKEN": "token",
"VERSION": "2.0",
"accept": "application/json",
"cache-control": "no-cache"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Sample payload for the token
{
"partnerId": "partner_api_key"
}
The body for the token is defined below
Parameter | Type | Mandatory | Description |
---|---|---|---|
partnerId | STRING | Yes | Partner API key provided |
productCode | STRING | No | This parameter returns details of the specific product code in the API response |
category | STRING | No | This parameter returns all products that belong to the specified category |
biller | STRING | No | This parameter returns all products that belong to the specified biller |
status | STRING | No | This parameter returns details of the specific product status whether it is active or Inactive |
Response
This API is called to check all Product lists.
Sample response for Product list Request
{
"responseCode": 200,
"success": true,
"message": {
"ID": "Daftar Produk.",
"EN": "Product list."
},
"data": [
{
"name": "Testing004",
"description": "",
"code": "T004",
"logo": "",
"amount": 0,
"adminFee": 2500,
"biller": "PLN Postpaid",
"category": "PDAM",
"active": false,
"type": "postpaid"
},
{
"name": "PLN Prepaid 500.000",
"description": "",
"code": "PLSTPL500",
"logo": "",
"amount": 24700,
"adminFee": 0,
"biller": "PLN Prepaid",
"category": "Listrik",
"active": true,
"type": "prepaid"
}
]
}
Below are details for each field and the value type.
TOP LEVEL
Parameter | Type | Description |
---|---|---|
responseCode | INT | Status of the product list request. Refer to the Response code section/document for more details |
message | JSON | Messages in Bahasa and English describing the RC above. |
success | BOOLEAN | Status of api |
data | ARRAY | List of products |
DATA OBJECT
Parameter | Type | Description |
---|---|---|
name | STRING | Product name. |
description | STRING | Product description. |
code | STRING | Product code |
logo | STRING | Logo of each product |
amount | FLOAT | Product amount |
adminFee | FLOAT | Product admin fee |
active | BOOLEAN | Product Status |
type | STRING | Type of product (postpaid, prepaid) |
biller | STRING | Biller Name |
category | STRING | Category Name |