Individual APIs

OpenG2P Social Registry APIs are CRUD APIs that allow the end-user to create, read, and update the Individual registry data.

The Individual APIs contain the following CRUD operations.

  • Create: Allows the creation of a new individual entity.

  • Read: Enables the fetching of details about an individual entity.

  • Update: Supports modifying existing individual entities.

Delete API is not supported. Contact the Administrator to delete an individual registrant.

The endpoints of Individual APIs and their definitions are given below.

Method
API End Point
API Functionality

POST

/registry/individual

This endpoint allows the end-user to create a new individual.

GET

/registry/individual/{_id}

This endpoint allows the end-user to retrieve the partner's information by a specific ID.

GET

/registry/individual

This endpoint allows the end-user to search the individual based on a specific ID or name.

The API request and response values used in the below sections are only an example for understanding. Do not use the example values in an API call.

Authentication

The Individual APIs use a session-based authentication mechanism provided by Odoo. This involves initiating a session using login credentials. The end-user must authenticate by calling the /web/session/authenticate endpoint with the appropriate parameters in the request body. Successfully authenticated sessions generate a session ID, which is then used to authenticate subsequent API requests.

Subsequent API requests must include the session ID in the header to maintain the authenticated session.

Session authentication endpoint

Name
Value

Method

GET

URL

<openg2p.sandbox.net>/web/session/authenticate

Body parameters

Parameter Name
Description
Mandatory/Optional
Data Type

jsonrpc

The version of the JSON-RPC protocol

Mandatory

String

db

The name of the database

Mandatory

String

login

The user's login name

Mandatory

String

password

The user's password

Mandatory

String

Sample cURL request

curl --location --request GET '<openg2p.sandox.net>/web/session/authenticate' \
--header 'Content-Type: application/json' \
--header 'Cookie: frontend_lang=en_US; session_id=c7b75ddb25f94ced204b78e6d7ea115c4a7c0f7e' \
--data '{
    "jsonrpc": "2.0", 
    "params": {
        "db": <db-name>, 
        "login": <login>, 
        "password": <password>
    }
}
'

Sample request

{
    "jsonrpc": "2.0", 
    "params": {
        "db": <db-name>, 
        "login": <login>, 
        "password": <password>
    }
}

Create individual registry

This endpoint allows the end-user to create a new individual.

Key request parameters

Name
Value

Method

POST

URI

<openg2p.sandbox.net>/api/v1/registry/individual

Cookie

session_id=<session_id>

Request body parameters

Parameter Name
Description
Mandatory/Optional
Data Type

name

The name of an individual

Mandatory

String

id_type

The type of the ID

Mandatory

String

value

The value of the ID

Mandatory

String

expiry_date

The date of expiry of an individual registry

Mandatory

Date

Format: YYYY-MM-DD

registration_date

The date of an individual registration

Optional

Date

Format: YYYY-MM-DD

phone_no

The contact number of an individual

Mandatory

String

date_collected

The date on which an individual data is collected

Optional

String

email

The email ID of an individual

Optional

String

address

The address of an individual

Optional

String

bank_name

The bank name of an individual

Optional

String

acc_number

The account number of an individual

Optional

String

given_name

The given name of an individual

Mandatory

String

addl_name

The additional name of an individual

Mandatory

String

family_name

The family name of an individual

Mandatory

String

gender

The gender of an individual

Mandatory

String

birthdate

The date of birth of an individual

Mandatory

Date

Format: YYYY-MM-DD

birth_place

The place of birth of an individual

Mandatory

Date

Format: YYYY-MM-DD

is_group

It defines whether the individual belongs to a group or not

Mandatory

Boolean

True

False

Note:

The default values is false.

Sample cURL request

curl --request POST
--url https://openg2p.stoplight.io/api/v1/registry/individual/
--header 'Accept: application/json'
--header 'Accept-Language: '
--header 'Content-Type: application/json'
--header 'Cookie: session_id=<session_id>'
--data '{ "name": "string", "ids": [ { "id_type": "string", "value": "string", "expiry_date": "2019-08-24" } ], "registration_date": "2019-08-24", "phone_numbers": [ { "phone_no": "string", "date_collected": "2019-08-24" } ], "email": "string", "address": "string", "bank_ids": [ { "bank_name": "string", "acc_number": "string" } ], "given_name": "string", "addl_name": "string", "family_name": "string", "gender": "string", "birthdate": "2019-08-24", "birth_place": "string", "is_group": false }'

Sample request

{ 
 "name": "string",
  "ids": [ { "id_type": "string", 
             "value": "string",
             "expiry_date": "2019-08-24" } ],
  "registration_date": "2019-08-24",
  "phone_numbers": [ { "phone_no": "string",
                       "date_collected": "2019-08-24" } ],
  "email": "string",
  "address": "string",
  "bank_ids": [ { "bank_name": "string",
                  "acc_number": "string" } ],
  "given_name": "string",
  "addl_name": "string",
  "family_name": "string",
  "gender": "string",
  "birthdate": "2019-08-24",
  "birth_place": "string",
  "is_group": false
  }

Sample response

Successful response

{
  "id": 0,
  "name": "string",
  "reg_ids": [
    {
      "id": 0,
      "id_type_as_str": "string",
      "value": "string",
      "expiry_date": "2019-08-24"
    }
  ],
  "is_group": false,
  "registration_date": "2019-08-24",
  "phone_number_ids": [
    {
      "id": 0,
      "phone_no": "string",
      "phone_sanitized": "string",
      "date_collected": "2019-08-24"
    }
  ],
  "email": "string",
  "address": "string",
  "create_date": "2019-08-24T14:15:22Z",
  "write_date": "2019-08-24T14:15:22Z",
  "bank_ids": [
    {
      "bank_name": "string",
      "acc_number": "string"
    }
  ],
  "given_name": "string",
  "addl_name": "string",
  "family_name": "string",
  "gender": "string",
  "birthdate": "2019-08-24",
  "age": "string",
  "birth_place": "string"
}

Get individual registry

This endpoint allows the end-user to retrieve the individual registry data based on a specific ID.

Key request parameters

Name
Value

Method

GET

URI

<openg2p.sandbox.net>/api/v1/registry/individual/{_id}

Cookie

session_id=<session_id>

Parameter Name
Description
Mandatory/Optional
Data Type

id

The ID of an individual

Mandatory

Number

Example: 124567

Sample cURL request

curl --request GET
--url https://openg2p.stoplight.io/api/v1/registry/group/_id
--header 'Accept: application/json'
--header 'Accept-Language: '
--header 'Cookie: session_id=<session_id>'

Sample response

Successful response

{
  "id": 0,
  "name": "string",
  "reg_ids": [
    {
      "id": 0,
      "id_type_as_str": "string",
      "value": "string",
      "expiry_date": "2019-08-24"
    }
  ],
  "is_group": false,
  "registration_date": "2019-08-24",
  "phone_number_ids": [
    {
      "id": 0,
      "phone_no": "string",
      "phone_sanitized": "string",
      "date_collected": "2019-08-24"
    }
  ],
  "email": "string",
  "address": "string",
  "create_date": "2019-08-24T14:15:22Z",
  "write_date": "2019-08-24T14:15:22Z",
  "bank_ids": [
    {
      "bank_name": "string",
      "acc_number": "string"
    }
  ],
  "given_name": "string",
  "addl_name": "string",
  "family_name": "string",
  "gender": "string",
  "birthdate": "2019-08-24",
  "age": "string",
  "birth_place": "string"
}

Search individual registry

This endpoint allows the end-user to search the individuals based on a specific ID or name.

Key request parameters

Name
Value

Method

GET

URI

<openg2p.sandbox.net>/api/v1/registry/individual/{_id}

(or)

<openg2p.sandbox.net>/api/v1/registry/individual/{name}

Cookie

session_id=<session_id>

Parameter Name
Description
Mandatory/Optional
Data Type

id

The ID of an individual

Optional

Number

Example: 4356789

name

The name of an individual

Optional

String

Example: John Miller

Sample cURL request

curl --request GET
--url https://openg2p.stoplight.io/api/v1/registry/individual
--header 'Accept: application/json'
--header 'Accept-Language: '
--header 'Cookie: session_id=<session_id>'

Sample response

Successful response

[
  {
    "id": 0,
    "name": "string",
    "reg_ids": [
      {
        "id": 0,
        "id_type_as_str": "string",
        "value": "string",
        "expiry_date": "2019-08-24"
      }
    ],
    "is_group": false,
    "registration_date": "2019-08-24",
    "phone_number_ids": [
      {
        "id": 0,
        "phone_no": "string",
        "phone_sanitized": "string",
        "date_collected": "2019-08-24"
      }
    ],
    "email": "string",
    "address": "string",
    "create_date": "2019-08-24T14:15:22Z",
    "write_date": "2019-08-24T14:15:22Z",
    "bank_ids": [
      {
        "bank_name": "string",
        "acc_number": "string"
      }
    ],
    "given_name": "string",
    "addl_name": "string",
    "family_name": "string",
    "gender": "string",
    "birthdate": "2019-08-24",
    "age": "string",
    "birth_place": "string"
  }
]

API specification

The Individual APIs are available in Stoplight at the following link.

openg2p-crud-apis

Last updated

Logo

Copyright © 2024 OpenG2P. This work is licensed under Creative Commons Attribution International LicenseCC-BY-4.0 unless otherwise noted.