Skip to content

Koleksi Postman Rivalistic

Untuk memudahkan pengembang dalam mengintegrasikan dan menguji API Rivalistic, kami menyediakan koleksi Postman yang lengkap. Koleksi ini mencakup semua endpoint API yang tersedia beserta contoh permintaan dan respons.

Mengunduh dan Mengimpor Koleksi

  1. Unduh file koleksi Postman dari link berikut: Rivalistic API Collection
  2. Buka aplikasi Postman
  3. Klik tombol "Import" di sudut kiri atas
  4. Pilih file koleksi yang telah diunduh
  5. Koleksi akan tersedia di sidebar kiri aplikasi Postman Anda

Mengatur Environment Variables

Koleksi ini menggunakan environment variables untuk memudahkan pengujian. Buat environment baru di Postman dan atur variabel berikut:

VariabelDeskripsi
baseUrlURL dasar API (contoh: "https://api.rivalistic.com")
x-api-keyAPI key Anda dari dashboard Rivalistic (format: riv_sh7mLX53C0wka5b65P5LoLKYJm6PaDUv)

Endpoint yang Tersedia

Koleksi ini mencakup endpoint-endpoint berikut:

1. Face Enroll API

Mendaftarkan gambar wajah baru ke database pribadi Anda.

  • URL: /v1/face/enroll
  • Metode: POST
  • Header: x-api-key
  • Body:
    json
    {
        "database_name": "default",
        "image_base64": "data:image/jpeg;base64,..."
    }

Endpoint ini memiliki contoh respons untuk:

  • Sukses (200 OK)
  • Saldo kredit tidak mencukupi (403 Forbidden)

2. Face Find API

Mencari kecocokan wajah dalam database pribadi Anda.

  • URL: /v1/face/find
  • Metode: POST
  • Header: x-api-key
  • Body:
    json
    {
        "database_name": "default",
        "image_base64": "data:image/jpeg;base64,...",
        "threshold": 0.4
    }

Endpoint ini memiliki contoh respons untuk:

  • Sukses dengan kecocokan (200 OK)
  • Sukses tanpa kecocokan (200 OK)
  • API key tidak valid (401 Unauthorized)

3. Face Verify API

Membandingkan dua gambar wajah untuk menentukan apakah keduanya adalah orang yang sama.

  • URL: /v1/face/verify
  • Metode: POST
  • Header: x-api-key
  • Body:
    json
    {
        "database_name": "default",
        "image_base64_1": "data:image/jpeg;base64,...",
        "image_base64_2": "data:image/jpeg;base64,..."
    }

Endpoint ini memiliki contoh respons untuk:

  • Sukses dengan kecocokan (200 OK)
  • Sukses tanpa kecocokan (200 OK)

Contoh Respons

Face Enroll - Sukses

json
{
    "message": "Image uploaded and database indexed successfully",
    "data": {
        "image_id": "DO46s5vDwayAFMVANMkM",
        "enroll_status": true
    }
}

Face Enroll - Saldo Kredit Tidak Mencukupi

json
{
    "message": "Insufficient credit balance. Required: 40, Current: 30",
    "data": {
        "required_balance": 40
    }
}

Face Find - Sukses dengan Kecocokan

json
{
    "message": "Face search completed",
    "data": [
        {
            "imageId": "cGdH12x4sdY4xs0BnGHo",
            "confidence": 0.4999999999999999
        },
        {
            "imageId": "FPUIY1YtM7sHy9uoDXtk",
            "confidence": 0.4999999999999999
        },
        {
            "imageId": "wj4la95nGtPelVMEBEa0",
            "confidence": 0.4999999999999999
        },
        {
            "imageId": "4xdIg6Gx5q42Moq6gaqB",
            "confidence": 0.4999999999999999
        },
        {
            "imageId": "kry03yjs53duj3DDQdEs",
            "confidence": 0.4999999999999999
        }
    ]
}

Face Find - Sukses tanpa Kecocokan

json
{
    "message": "Face search completed",
    "data": []
}

Face Verify - Sukses dengan Kecocokan

json
{
    "message": "Face verification completed",
    "data": {
        "match": true,
        "confidence": 0.662339141531108,
        "raw_distance": 0.33766085846889204,
        "threshold": 0.5
    }
}

Face Verify - Sukses tanpa Kecocokan

json
{
    "message": "Face verification completed",
    "data": {
        "match": false,
        "confidence": 0.27415011203261375,
        "raw_distance": 0.7258498879673863,
        "threshold": 0.5
    }
}

Memahami Respons API

Confidence dan Threshold

  • Confidence: Nilai kepercayaan (0-1) bahwa dua wajah cocok. Nilai yang lebih tinggi berarti kecocokan yang lebih kuat.
  • Threshold: Nilai batas untuk menentukan kecocokan. Jika confidence melebihi threshold, wajah dianggap cocok.
  • Raw Distance: Jarak Euclidean antara fitur wajah. Nilai yang lebih rendah menunjukkan kecocokan yang lebih kuat.

Kriteria Match

  • match: true - Jika confidence >= threshold
  • match: false - Jika confidence < threshold

Kode JSON Koleksi

Berikut adalah kode JSON lengkap untuk koleksi Postman Rivalistic:

json
{
    "info": {
        "_postman_id": "1ea3e717-0e13-4543-ad80-9cac5a89c3d2",
        "name": "API Service",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
        "_exporter_id": "21809376"
    },
    "item": [
        {
            "name": "Verify",
            "request": {
                "auth": {
                    "type": "noauth"
                },
                "method": "POST",
                "header": [
                    {
                        "key": "x-api-key",
                        "value": "{{x-api-key}}",
                        "type": "text"
                    }
                ],
                "body": {
                    "mode": "raw",
                    "raw": "{\r\n    \"database_name\": \"default\",\r\n    \"image_base64_1\": \"{{your_base64}}\",\r\n    \"image_base64_2\": \"{{your_base64}}\"\r\n}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "{{baseUrl}}/v1/face/verify",
                    "host": [
                        "{{baseUrl}}"
                    ],
                    "path": [
                        "v1",
                        "face",
                        "verify"
                    ]
                }
            },
            "response": [
                {
                    "name": "Success",
                    "originalRequest": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "x-api-key",
                                "value": "{{x-api-key}}",
                                "type": "text"
                            }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\r\n    \"database_name\": \"default\",\r\n    \"image_base64_1\": \"{{your_base64}}\",\r\n    \"image_base64_2\": \"{{your_base64}}\"\r\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        },
                        "url": {
                            "raw": "{{baseUrl}}/v1/face/verify",
                            "host": [
                                "{{baseUrl}}"
                            ],
                            "path": [
                                "v1",
                                "face",
                                "verify"
                            ]
                        }
                    },
                    "status": "OK",
                    "code": 200,
                    "_postman_previewlanguage": "json",
                    "header": [
                        {
                            "key": "vary",
                            "value": "Origin"
                        },
                        {
                            "key": "content-type",
                            "value": "application/json; charset=utf-8"
                        },
                        {
                            "key": "content-length",
                            "value": "145"
                        },
                        {
                            "key": "Date",
                            "value": "Sun, 13 Jul 2025 00:12:38 GMT"
                        },
                        {
                            "key": "Connection",
                            "value": "keep-alive"
                        },
                        {
                            "key": "Keep-Alive",
                            "value": "timeout=72"
                        }
                    ],
                    "cookie": [],
                    "body": "{\n    \"message\": \"Face verification completed\",\n    \"data\": {\n        \"match\": true,\n        \"confidence\": 0.662339141531108,\n        \"raw_distance\": 0.33766085846889204,\n        \"threshold\": 0.5\n    }\n}"
                },
                {
                    "name": "Success but no match",
                    "originalRequest": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "x-api-key",
                                "value": "{{x-api-key}}",
                                "type": "text"
                            }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\r\n    \"database_name\": \"default\",\r\n    \"image_base64_1\": \"{{female-1-1}}\",\r\n    \"image_base64_2\": \"{{rival-1-1}}\"\r\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        },
                        "url": {
                            "raw": "{{baseUrl}}/v1/face/verify",
                            "host": [
                                "{{baseUrl}}"
                            ],
                            "path": [
                                "v1",
                                "face",
                                "verify"
                            ]
                        }
                    },
                    "status": "OK",
                    "code": 200,
                    "_postman_previewlanguage": "json",
                    "header": [
                        {
                            "key": "vary",
                            "value": "Origin"
                        },
                        {
                            "key": "content-type",
                            "value": "application/json; charset=utf-8"
                        },
                        {
                            "key": "content-length",
                            "value": "147"
                        },
                        {
                            "key": "Date",
                            "value": "Sun, 13 Jul 2025 01:29:05 GMT"
                        },
                        {
                            "key": "Connection",
                            "value": "keep-alive"
                        },
                        {
                            "key": "Keep-Alive",
                            "value": "timeout=72"
                        }
                    ],
                    "cookie": [],
                    "body": "{\n    \"message\": \"Face verification completed\",\n    \"data\": {\n        \"match\": false,\n        \"confidence\": 0.27415011203261375,\n        \"raw_distance\": 0.7258498879673863,\n        \"threshold\": 0.5\n    }\n}"
                }
            ]
        },
        {
            "name": "Enroll",
            "request": {
                "auth": {
                    "type": "noauth"
                },
                "method": "POST",
                "header": [
                    {
                        "key": "x-api-key",
                        "value": "{{x-api-key}}",
                        "type": "text"
                    }
                ],
                "body": {
                    "mode": "raw",
                    "raw": "{\r\n    \"database_name\": \"default\",\r\n    \"image_base64\": \"{{female-1-1}}\"\r\n}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "{{baseUrl}}/v1/face/enroll",
                    "host": [
                        "{{baseUrl}}"
                    ],
                    "path": [
                        "v1",
                        "face",
                        "enroll"
                    ]
                }
            },
            "response": [
                {
                    "name": "Insufficient credit balance",
                    "originalRequest": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "x-api-key",
                                "value": "riv_sh7mLX53C0wka5b65P5LoLKYJm6PaDUv",
                                "type": "text"
                            }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\r\n    \"database_name\": \"default\",\r\n    \"image_base64\": \"{{your_base64}}\"\r\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        },
                        "url": {
                            "raw": "https://api.rivalistic.com/v1/face/enroll",
                            "host": [
                                "localhost"
                            ],
                            "port": "5000",
                            "path": [
                                "v1",
                                "face",
                                "enroll"
                            ]
                        }
                    },
                    "status": "Forbidden",
                    "code": 403,
                    "_postman_previewlanguage": "json",
                    "header": [
                        {
                            "key": "vary",
                            "value": "Origin"
                        },
                        {
                            "key": "content-type",
                            "value": "application/json; charset=utf-8"
                        },
                        {
                            "key": "content-length",
                            "value": "99"
                        },
                        {
                            "key": "Date",
                            "value": "Sat, 12 Jul 2025 23:55:25 GMT"
                        },
                        {
                            "key": "Connection",
                            "value": "keep-alive"
                        },
                        {
                            "key": "Keep-Alive",
                            "value": "timeout=72"
                        }
                    ],
                    "cookie": [],
                    "body": "{\n    \"message\": \"Insufficient credit balance. Required: 40, Current: 30\",\n    \"data\": {\n        \"required_balance\": 40\n    }\n}"
                },
                {
                    "name": "Success",
                    "originalRequest": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "x-api-key",
                                "value": "riv_sh7mLX53C0wka5b65P5LoLKYJm6PaDUv",
                                "type": "text"
                            }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\r\n    \"database_name\": \"default\",\r\n    \"image_base64\": \"{{your_base64}}\"\r\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        },
                        "url": {
                            "raw": "https://api.rivalistic.com/v1/face/enroll",
                            "host": [
                                "localhost"
                            ],
                            "port": "5000",
                            "path": [
                                "v1",
                                "face",
                                "enroll"
                            ]
                        }
                    },
                    "status": "OK",
                    "code": 200,
                    "_postman_previewlanguage": "json",
                    "header": [
                        {
                            "key": "vary",
                            "value": "Origin"
                        },
                        {
                            "key": "content-type",
                            "value": "application/json; charset=utf-8"
                        },
                        {
                            "key": "content-length",
                            "value": "126"
                        },
                        {
                            "key": "Date",
                            "value": "Sat, 12 Jul 2025 23:56:34 GMT"
                        },
                        {
                            "key": "Connection",
                            "value": "keep-alive"
                        },
                        {
                            "key": "Keep-Alive",
                            "value": "timeout=72"
                        }
                    ],
                    "cookie": [],
                    "body": "{\n    \"message\": \"Image uploaded and database indexed successfully\",\n    \"data\": {\n        \"image_id\": \"DO46s5vDwayAFMVANMkM\",\n        \"enroll_status\": true\n    }\n}"
                }
            ]
        },
        {
            "name": "Find",
            "request": {
                "auth": {
                    "type": "noauth"
                },
                "method": "POST",
                "header": [
                    {
                        "key": "x-api-key",
                        "value": "{{x-api-key}}",
                        "type": "text"
                    }
                ],
                "body": {
                    "mode": "raw",
                    "raw": "{\r\n    \"database_name\": \"default\",\r\n    \"image_base64\": \"{{female-1-2}}\",\r\n    \"threshold\": 0.4\r\n}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "{{baseUrl}}/v1/face/find",
                    "host": [
                        "{{baseUrl}}"
                    ],
                    "path": [
                        "v1",
                        "face",
                        "find"
                    ]
                }
            },
            "response": [
                {
                    "name": "Invalid api key",
                    "originalRequest": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "x-api-key",
                                "value": "riv_i8BoVA8rDlKmxk8lILhr1fZwaLsYitqa",
                                "type": "text"
                            }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\r\n    \"database_name\": \"default\",\r\n    \"image_base64\": \"{{your_base64}}\"\r\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        },
                        "url": {
                            "raw": "{{baseUrl}}/v1/face/find",
                            "host": [
                                "{{baseUrl}}"
                            ],
                            "path": [
                                "v1",
                                "face",
                                "find"
                            ]
                        }
                    },
                    "status": "Unauthorized",
                    "code": 401,
                    "_postman_previewlanguage": "json",
                    "header": [
                        {
                            "key": "vary",
                            "value": "Origin"
                        },
                        {
                            "key": "content-type",
                            "value": "application/json; charset=utf-8"
                        },
                        {
                            "key": "content-length",
                            "value": "39"
                        },
                        {
                            "key": "Date",
                            "value": "Sun, 13 Jul 2025 00:00:32 GMT"
                        },
                        {
                            "key": "Connection",
                            "value": "keep-alive"
                        },
                        {
                            "key": "Keep-Alive",
                            "value": "timeout=72"
                        }
                    ],
                    "cookie": [],
                    "body": "{\n    \"message\": \"Invalid API key\",\n    \"data\": {}\n}"
                },
                {
                    "name": "Success",
                    "originalRequest": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "x-api-key",
                                "value": "{{x-api-key}}",
                                "type": "text"
                            }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\r\n    \"database_name\": \"default\",\r\n    \"image_base64\": \"{{your_base64}}\"\r\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        },
                        "url": {
                            "raw": "{{baseUrl}}/v1/face/find",
                            "host": [
                                "{{baseUrl}}"
                            ],
                            "path": [
                                "v1",
                                "face",
                                "find"
                            ]
                        }
                    },
                    "status": "OK",
                    "code": 200,
                    "_postman_previewlanguage": "json",
                    "header": [
                        {
                            "key": "vary",
                            "value": "Origin"
                        },
                        {
                            "key": "content-type",
                            "value": "application/json; charset=utf-8"
                        },
                        {
                            "key": "content-length",
                            "value": "513"
                        },
                        {
                            "key": "Date",
                            "value": "Sun, 13 Jul 2025 00:02:12 GMT"
                        },
                        {
                            "key": "Connection",
                            "value": "keep-alive"
                        },
                        {
                            "key": "Keep-Alive",
                            "value": "timeout=72"
                        }
                    ],
                    "cookie": [],
                    "body": "{\n    \"message\": \"Face search completed\",\n    \"data\": [\n        {\n            \"imageId\": \"cGdH12x4sdY4xs0BnGHo\",\n            \"confidence\": 0.4999999999999999\n        },\n        {\n            \"imageId\": \"FPUIY1YtM7sHy9uoDXtk\",\n            \"confidence\": 0.4999999999999999\n        },\n        {\n            \"imageId\": \"wj4la95nGtPelVMEBEa0\",\n            \"confidence\": 0.4999999999999999\n        },\n        {\n            \"imageId\": \"4xdIg6Gx5q42Moq6gaqB\",\n            \"confidence\": 0.4999999999999999\n        },\n        {\n            \"imageId\": \"kry03yjs53duj3DDQdEs\",\n            \"confidence\": 0.4999999999999999\n        },\n        {\n            \"imageId\": \"DO46s5vDwayAFMVANMkM\",\n            \"confidence\": 0.4999999999999999\n        },\n        {\n            \"imageId\": \"fjH2kv1cHHd2IY8GW0br\",\n            \"confidence\": 0.4999999999999999\n        }\n    ]\n}"
                },
                {
                    "name": "Success with no matches",
                    "originalRequest": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "x-api-key",
                                "value": "{{x-api-key}}",
                                "type": "text"
                            }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\r\n    \"database_name\": \"default\",\r\n    \"image_base64\": \"{{your_base64_2}}\"\r\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        },
                        "url": {
                            "raw": "{{baseUrl}}/v1/face/find",
                            "host": [
                                "{{baseUrl}}"
                            ],
                            "path": [
                                "v1",
                                "face",
                                "find"
                            ]
                        }
                    },
                    "status": "OK",
                    "code": 200,
                    "_postman_previewlanguage": "json",
                    "header": [
                        {
                            "key": "vary",
                            "value": "Origin"
                        },
                        {
                            "key": "content-type",
                            "value": "application/json; charset=utf-8"
                        },
                        {
                            "key": "content-length",
                            "value": "45"
                        },
                        {
                            "key": "Date",
                            "value": "Sun, 13 Jul 2025 00:11:19 GMT"
                        },
                        {
                            "key": "Connection",
                            "value": "keep-alive"
                        },
                        {
                            "key": "Keep-Alive",
                            "value": "timeout=72"
                        }
                    ],
                    "cookie": [],
                    "body": "{\n    \"message\": \"Face search completed\",\n    \"data\": []\n}"
                }
            ]
        }
    ],
    "event": [
        {
            "listen": "prerequest",
            "script": {
                "type": "text/javascript",
                "packages": {},
                "exec": [
                    ""
                ]
            }
        },
        {
            "listen": "test",
            "script": {
                "type": "text/javascript",
                "packages": {},
                "exec": [
                    ""
                ]
            }
        }
    ],
    "variable": [
        {
            "key": "baseUrl",
            "value": "https://api.rivalistic.com",
            "type": "string"
        }
    ]
}

Variabel untuk Contoh Gambar

Koleksi ini menggunakan variabel untuk gambar base64. Anda perlu menambahkan variabel-variabel berikut ke environment Anda dengan nilai berupa string base64 dari gambar wajah:

  • female-1-1 - Contoh gambar pertama dari subjek wanita
  • female-1-2 - Contoh gambar kedua dari subjek wanita
  • rival-1-1 - Contoh gambar dari subjek "Rival"

Dukungan

Jika Anda memiliki pertanyaan atau mengalami masalah dengan koleksi Postman ini, silakan hubungi dukungan kami di support@rivalistic.com.

Dokumentasi API Rivalistic