Group APIs

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

The Group APIs contain the following CRUD operations.

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

  • Read: Enables the fetching of details about a group entity.

  • Update: Supports modifying existing group entities.

Delete API is not supported. Contact the Administrator to delete a group registrant.

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

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 Group 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

Body parameters

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 group registry

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

Key request parameters

Request body parameters

Sample cURL request

curl --request POST
--url https://openg2p.stoplight.io/api/v1/registry/group/
--header 'Accept: application/json'
--header 'Accept-Language: '
--header 'Content-Type: application/json'
--header '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" } ], "is_group": true, "members": [ { "name": "string", "given_name": "string", "addl_name": "string", "family_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", "gender": "string", "birthdate": "2019-08-24", "birth_place": "string", "is_group": false, "kind": [ { "name": "string" } ], "bank_ids": [ { "bank_name": "string", "acc_number": "string" } ] } ], "kind": "string", "is_partial_group": true }'

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"
    }
  ],
  "is_group": true,
  "members": [
    {
      "name": "string",
      "given_name": "string",
      "addl_name": "string",
      "family_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",
      "gender": "string",
      "birthdate": "2019-08-24",
      "birth_place": "string",
      "is_group": false,
      "kind": [
        {
          "name": "string"
        }
      ],
      "bank_ids": [
        {
          "bank_name": "string",
          "acc_number": "string"
        }
      ]
    }
  ],
  "kind": "string",
  "is_partial_group": true
}

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": true,
  "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"
    }
  ],
  "group_membership_ids": [],
  "is_partial_group": true
}

Get group registry

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

Key request parameters

Sample cURL request

curl --request GET
--url https://openg2p.stoplight.io/api/v1/registry/group/_id
--header 'Accept: application/json'
--header 'Accept-Language: '
--header '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": true,
  "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"
    }
  ],
  "group_membership_ids": [],
  "is_partial_group": true
}

Search group registry

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

Key request parameters

Sample cURL request

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

Sample response

<WIP>

API specification

The Group 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.