API Documentation

Getting Started


Dokumen ini menjelaskan penggunaan API resmi dari ResiID.

Skema


Endpoint API tersedia di https://resi.id/api dan memiliki response dengan format JSON.

HTTP Verbs

ResiID API menggunakan HTTP verbs yang sesuai untuk setiap action.

verbs deskripsi
GET Mengambil sumber daya
POST Membuat sumber daya
PUT mengupdate sumber daya
DELETE Menghapus sumber daya
Pesan Error

Apabila kesalahan terjadi baik di sisi server atau klien, pesan error akan dikembalikan dalam array error. Sebagai contoh:

401 Unauthorized
{
    "error": {
        "message": "Token not provided",
        "status_code": 401
    }
}

Authentication


User Authentication

ResiID API menggunakan OAuth2 untuk mengotentikasi dan mengotorisasi pengguna. OAuth2 ResiID adalah di url https://resi.id/api/auth

Authorization workflow

Sebelum menggunakan API lebih lanjut, Anda harus melakukan proses otorisasi terlebih dahulu. Langkah-langkahnya dijelaskan dibawah ini:

  1. Lakukan request POST ke https://resi.id/api/auth/login dengan parameter berikut.
    parameter deskripsi
    email Email Anda yang terdaftar di ResiID
    password Password Anda
  2. Jika berhasil maka akan mendapatkan respon dengan format JSON seperti di bawah ini:
    {
        "status": "ok",
        "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vbmV3cmVzaS5sb2NhbDo3ODg4L2FwaS9hdXRoL2xvZ2luIiwiaWF0IjoxNTQwNzgyOTU4LCJuYmYiOjE1NDA3ODI5NTgsImp0aSI6ImlmT2loWjY1QVptems3dFkiLCJzdWIiOjEsInBydiI6Ijg3ZTBhZjFlZjlmZDE1ODEyZmRlYzk3MTUzYTE0ZTBiMDQ3NTQ2YWEifQ.O6O2xse4JOReyQutaAyxjmOGXAxEd3eDDIX1DWT96cI",
        "expires_in": null
    }
    Access Token ini akan kadaluarsa sesuai dengan masa berlangganan Anda.
  3. Selanjutnya, untuk melakukan Request Anda harus menggunakan Access Token OAuth Bearer pada header HTTP:
    Authorization: Bearer ACCESS_TOKEN_ANDA

Tracking Airwaybill


Untuk melacak pengiriman dari nomor resi atau airwaybill.

GET /api/track
Parameter
parameter deskripsi
courier Kode kurir yang akan Anda lacak. Kode yang tersedia: jne, jnt, pos, sicepat, wahana, rpx, rex, dpex, tiki, lionparcel, shipper
awb Nomor resi / airwaybill
Response
{
    "summary": {
        "awb": "011850267419618",
        "courier": "jne",
        "service": "CTC15",
        "status": "DELIVERED",
        "date": "24-10-2018 19:28",
        "desc": "ACC",
        "amount": "9000",
        "weight": "1"
    },
    "detail": {
        "origin": "JAKARTA",
        "destination": "KEBON JERUK ,JAKARTA BARAT",
        "shipper": "24 FIKASHOP",
        "receiver": "VANIA"
    },
    "history": [
        {
            "date": "24-10-2018 19:28",
            "desc": "SHIPMENT RECEIVED BY JNE COUNTER OFFICER AT [JAKARTA]",
            "location": ""
        },
        {
            "date": "24-10-2018 20:57",
            "desc": "RECEIVED AT SORTING CENTER [JAKARTA]",
            "location": ""
        },
        {
            "date": "24-10-2018 21:23",
            "desc": "SHIPMENT FORWARDED TO DESTINATION [JAKARTA, ANGKE(DESP)]",
            "location": ""
        },
        {
            "date": "24-10-2018 22:50",
            "desc": "SHIPMENT PICKED UP BY JNE COURIER [JAKARTA]",
            "location": ""
        },
        {
            "date": "25-10-2018 00:04",
            "desc": "RECEIVED AT INBOUND STATION [JAKARTA, ANGKE(DESP)]",
            "location": ""
        },
        {
            "date": "25-10-2018 07:29",
            "desc": "WITH DELIVERY COURIER [JAKARTA]",
            "location": ""
        },
        {
            "date": "25-10-2018 09:01",
            "desc": "DELIVERED TO [vania | 25-10-2018 09:01 ]",
            "location": ""
        }
    ]
}

Webhook


Apabila Anda ingin mendapatkan notifikasi via webhook dari hasil lacak resi, gunakan endpoint dibawah ini:

POST /api/track-queue
body desc
courier Kode kurir yang akan Anda lacak. Kode yang tersedia: jne, jnt, pos, sicepat, wahana, rpx, rex, dpex, tiki, lionparcel, shipper
awb Nomor resi / airwaybill
external_id External ID untuk mengenali nomor resi dari aplikasi Anda (misal ORDER_ID di app Anda).
Response
{
  "user_id": 613,
  "courier": "jne",
  "awb": "150450014862419",
  "is_queue": 1,
  "status": 1,
  "source": "api",
  "external_id": "o-123-2019",
  "updated_at": "2019-06-19 11:35:50",
  "created_at": "2019-06-19 11:35:50",
  "id": 1794438
}

Dengan hit endpoint ini sistem akan memasukkan AWB ke Queue untuk diproses, dan setelah mendapat response dari server kurir maka sistem akan mengirimkan notifikasi ke Webhook URL Anda.

ResiID akan melacak secara berkala dan Webhook dikirimkan setiap ada update lokasi dan status pengiriman hingga statusnya DELIVERED.

Webhook response example
{"result":{"status":"ON PROCESS","summary":{"awb":"150450014862419","courier":"jne","service":"REG19","date":"2019-06-18 16:49:00","desc":"SEPATU ","amount":"43000","weight":"1"},"detail":{"origin":"BATAM","destination":"KUNINGAN, KAB KUNINGAN","shipper":"03ALINA","receiver":"DIAN RATNA KHRISTIAN "},"history":[{"date":"2019-06-18 16:49:00","desc":"Shipment Received By Jne Counter Officer At [batam]","location":"BATAM"},{"date":"2019-06-18 21:02:00","desc":"Shipment Picked Up By Jne Courier [batam]","location":"BATAM"},{"date":"2019-06-18 21:42:00","desc":"Received At Sorting Center [batam]","location":"BATAM"},{"date":"2019-06-19 00:40:00","desc":"Processed At Sorting Center [batam]","location":"BATAM"}]},"external_id":"o-123-2019"}

User


Get user info

Untuk mendapatkan info profile Anda

GET /api/auth/me
Response
{
    "id": 613,
    "name": "resi_id",
    "email": "dev@resi.id",
    "email_verified_at": null,
    "is_active": 1,
    "created_at": "2018-10-21 10:53:55",
    "updated_at": "2018-10-21 10:53:55"
}