Dokumentasi

BAPENDA Open API adalah Application Programming Interfaces (APIs) yang dikembangkan oleh BAPENDA untuk memungkinkan integrasi antara aplikasi Anda dan layanan kami.

Authentication

BAPENDA Open API menggunakan OAuth2 framework sebagai proses otorisasi dalam menentukan hak akses pihak ketiga. Sebelum melakukan proses API request ke layanan retribusi, anda harus mendapatkan token dengan cara memanggil endpoint Get Token.

Parameter di bawah ini harus disertakan dalam header request di setiap panggilan API :

Key Value
Authentication Bearer {{token}}

Token

Endpoint ini digunakan untuk menghasilkan token yang harus disertakan di setiap panggilan API. Letakkan token ini pada atribut Authorization yang ada di Header.

HTTP Request
POST https://retribusi.sumutprov.go.id/app-api/ouath/token
Request Header
Key Value Mandatory
Content-Type application/x-www-form-urlencoded Yes
Request Body
Field Data Type Mandatory Description
grant_type string Yes
client_id string Yes Consumer Key
client_secret string Yes Consumer Secret
username string Yes Consumer Username
password string Yes Consumer Password
Contoh Request
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://retribusi.sumutprov.go.id/app-api/oauth/token',
  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_POSTFIELDS => 'grant_type=password&client_id=xxxxxxxx-xxxx-xxxxx-xxxxx-xxxxxxxxxfe65&
  client_secret=xxxxxxxxxxxxxxxxxb4Qycj6pikrBPP&
  username=xxxxxxxxxx&password=xxxxxxxxxxxxxxxxx&scope=',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
                                            
Contoh Response
{"token_type":"Bearer","expires_in":1296000,"access_token":"Access Token","refresh_token":"Refresh token"}