Skip to content

Latest commit

 

History

History
393 lines (333 loc) · 15.5 KB

File metadata and controls

393 lines (333 loc) · 15.5 KB
layout
title description tableOfContents outline pagination
visible
true
visible
visible
true
visible
true
visible
true

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.

{% hint style="danger" %} Delete API is not supported. Contact the Administrator to delete a group registrant. {% endhint %}

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

MethodAPI End PointAPI Functionality
POST/registry/groupThis endpoint allows the end-user to create a new group.
GET/registry/group/{_id}This endpoint allows the end-user to retrieve the partner's information by a specific ID.
GET/registry/groupThis endpoint allows the end-user to search the group based on a specific ID or name.

{% hint style="danger" %} 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. {% endhint %}

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

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

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

Key request parameters

Name Value
Method POST
URI <openg2p.sandbox.net>/api/v1/registry/group
Cookie session_id=<session_id>

Request body parameters

Parameter NameDescriptionMandatory/OptionalData Type
name The name of a groupMandatoryString
idsIt contains the list of ID details of a grouparray
id_typeThe type of the ID of a groupMandatoryString
valueThe value of the ID of a groupMandatoryString
expiry_dateThe date of expiry of a group registryMandatory

Date

Format: YYYY-MM-DD

registration_dateThe date on which a group is registeredOptional

Date

Format: YYYY-MM-DD

phone_numbersIt contains the list of contact details of a grouparray
phone_noThe contact number of a groupMandatoryString
date_collectedThe date on which a group data is collectedOptionalString
emailThe email ID of a groupOptionalString
addressThe address of a groupOptionalString
bank_idsIt contains the list of bank details of a grouparray
bank_nameThe bank name of a groupOptional String
acc_numberThe account number of a groupOptionalString
is_groupIt defines whether the member belongs to group or notMandatory

Boolean

True

False

Note:

The default values is true.

membersIt contains the details of a member belongs to a grouparray
nameThe name of a memberMandatoryString
given_nameThe given name of a memberOptionalString
addl_nameThe additional name of a memberOptionalString
family_nameThe family name of a memberOptionalString
idsIt contains the ID details of a member belongs to a grouparray
id_typeThe type of the ID of a memberMandatoryString
valueThe value of the ID of a memberMandatoryString
expiry_dateThe date of expiry of a member registryMandatory

Date

Format: YYYY-MM-DD

registration_dateThe registration date of a memberOptional

Date

Format: YYYY-MM-DD

phone_numbersIt contains the contact details of a memberarray
emailThe email id of a memberMandatory
addressThe address of a memberMandatory
genderThe gender of a memberMandatoryString
birthdateThe date of birth of a memberMandatory

Date

Format: YYYY-MM-DD

birth_placeThe place of birth of a memberMandatory

Date

Format: YYYY-MM-DD

is_groupIt defines whether the member belongs to group or notOptional

Boolean

True

False

Note:

The default values is true.

kindIt contains list of the name of the kind allocated to a memberarray
nameThe name of the kind allocated to a memberMandatoryString
bank_idsIt contains the list of bank details of a memberarray
bank_nameThe bank name of a memberOptionalString
acc_numberThe account number of a memberOptionalString
kindIt contains the name of the kind allocated to a groupMandatory
is_partial_groupMandatory

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

{% tabs %} {% tab title="200" %} 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
}

{% endtab %}

{% tab title="422" %} Validation error

{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

{% endtab %} {% endtabs %}

Get group registry

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

Key request parameters

Name Value
Method GET
URI <openg2p.sandbox.net>/api/v1/registry/group/{_id}
Cookie session_id=<session_id>
Parameter NameDescriptionMandatory/OptionalData Type
idThe ID of a groupMandatory

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 'session_id=<session_id>'

Sample response

{% tabs %} {% tab title="200" %} 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
}

{% endtab %}

{% tab title="422" %} Validation error

{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

{% endtab %} {% endtabs %}

Search group registry

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

Key request parameters

Name Value
Method GET
URI

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

(or)

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

Cookie session_id=<session_id>
Parameter NameDescriptionMandatory/OptionalData Type
idThe ID of the individualOptional

Number

Example: 4356789

nameThe name of the individualOptional

String

Example: John Miller

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

{% tabs %} {% tab title="200" %} <WIP> {% endtab %}

{% tab title="422" %} Validation error

{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

{% endtab %} {% endtabs %}

API specification

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

openg2p-crud-apis