You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/developer_guide/api_usage/dci_api.md
+12-11Lines changed: 12 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,15 +15,17 @@ OpenSPP provides a RESTful API that adheres to the Digital Convergence Initiativ
15
15
- Client credentials (Client ID and Client Secret) obtained from the OpenSPP instance.
16
16
- Python 3.x and the `requests` library installed (`pip install requests`).
17
17
18
-
## 1. Authentication: Obtaining an Access Token
18
+
## Process
19
+
20
+
### Authentication: Obtaining an Access Token
19
21
20
22
The DCI API is secured using OAuth 2.0 with the Client Credentials grant type. Before making any data requests, your application must obtain a bearer token.
21
23
22
24
-**Endpoint**: `/oauth2/client/token`
23
25
-**Method**: `POST`
24
26
-**Body**: `x-www-form-urlencoded` with `grant_type`, `client_id`, `client_secret`, `db_name`.
Once authenticated, you can use the access token to perform a synchronous search on the registry.
56
58
@@ -61,7 +63,7 @@ Once authenticated, you can use the access token to perform a synchronous search
61
63
-`Content-Type`: `application/json`
62
64
-**Body**: A JSON object conforming to the DCI `sync/search` request specification.
63
65
64
-
### Example: Search for an Individual
66
+
**Example: Search for an Individual**
65
67
66
68
```python
67
69
search_url =f"{url}/registry/sync/search"
@@ -72,7 +74,7 @@ headers = {
72
74
}
73
75
74
76
# Example search payload based on DCI specification
75
-
# This searches for an individual with a specific phone number.
77
+
# This searches for an individual with a specific birthdate.
76
78
search_payload = {
77
79
"header": {
78
80
"message_id": "123456789020211216223812",
@@ -103,7 +105,7 @@ search_payload = {
103
105
"expression1": {
104
106
"attribute_name": "birthdate",
105
107
"operator": "eq",
106
-
"attribute_value": "06/15/2020"
108
+
"attribute_value": "2020-11-02"
107
109
}
108
110
}
109
111
]
@@ -125,7 +127,7 @@ else:
125
127
```
126
128
127
129
128
-
##3. Setup and Configuration
130
+
###Setup and Configuration
129
131
130
132
To use the DCI API, you must first configure a client in OpenSPP.
131
133
@@ -135,15 +137,14 @@ To use the DCI API, you must first configure a client in OpenSPP.
135
137
4.**Reveal Credentials**: A **Show** button will appear. Click it to reveal the `Client ID` and `Client Secret`.
136
138
5.**Important**: Copy these credentials immediately. For security, the **Show** button will disappear after you close the dialog, and you will not be able to retrieve the secret again.
137
139
138
-
## 4. Best Practices
140
+
## Best Practices
139
141
140
142
1.**Secure Credential Storage**: Never hard-code your `Client ID` or `Client Secret` in your application. Use environment variables or a secure secret management system.
141
143
2.**Token Management**: Access tokens are short-lived. Your application should handle token expiration and automatically request a new one when needed.
142
144
3.**Error Handling**: Implement robust error handling to manage different HTTP status codes and error responses from the API.
143
145
4.**Secure Connections**: Always use HTTPS for all API traffic to protect data in transit.
144
146
5.**Logging**: Log request `transaction_id`s and correlation IDs to help with troubleshooting and auditing.
Copy file name to clipboardExpand all lines: docs/developer_guide/api_usage/external_api_jsonrpc.md
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,14 +15,15 @@ This guide explains how to connect to and interact with OpenSPP Registry using t
15
15
- User credentials or API key with appropriate permissions.
16
16
- Python 3.x and the `requests` library installed (`pip install requests`).
17
17
18
-
## 1. Understanding JSON-RPC in OpenSPP
18
+
## Process
19
+
### Understanding JSON-RPC in OpenSPP
19
20
20
21
OpenSPP exposes much of its data and functionality via JSON-RPC endpoints. You can use these endpoints to authenticate, read, create, update, and delete records from external applications.
21
22
22
23
**Endpoint:**
23
24
-`/jsonrpc` — All JSON-RPC calls (authentication and model methods)
24
25
25
-
##1.1 JSON-RPC Payload Structure and Methods
26
+
###JSON-RPC Payload Structure and Methods
26
27
27
28
All interactions with the OpenSPP JSON-RPC API use a standard payload structure. Each request is a JSON object with the following keys:
28
29
@@ -59,11 +60,11 @@ payload = {
59
60
60
61
---
61
62
62
-
##1.2 Common Model Methods and Args
63
+
###Common Model Methods and Args
63
64
64
65
When using the `"object"` service with the `"execute_kw"` method, you can call various model methods. Here are the most common:
65
66
66
-
### `create`
67
+
**`create`**
67
68
Creates a new record.
68
69
69
70
**Args:**
@@ -79,7 +80,7 @@ Creates a new record.
79
80
**Result:**
80
81
Returns the ID of the newly created record.
81
82
82
-
### `write`
83
+
**`write`**
83
84
Updates existing records.
84
85
85
86
**Args:**
@@ -96,7 +97,7 @@ Updates existing records.
96
97
**Result:**
97
98
Returns a dictionary indicating the result of the update.
98
99
99
-
### `unlink`
100
+
**`unlink`**
100
101
Deletes records.
101
102
102
103
**Args:**
@@ -113,7 +114,7 @@ Deletes records.
113
114
Returns a dictionary indicating the result of the deletion.
114
115
115
116
116
-
### `search_read`
117
+
**`search_read`**
117
118
Searches for records and reads their fields.
118
119
119
120
**Args:**
@@ -141,7 +142,7 @@ Returns a dictionary of the search results.
141
142
142
143
---
143
144
144
-
##2. Authentication
145
+
###Authentication
145
146
146
147
You must authenticate before accessing most data. Use your password or an API key (recommended).
147
148
@@ -170,9 +171,9 @@ if not uid:
170
171
print("Authenticated UID:", uid)
171
172
```
172
173
173
-
##3. Working with Individuals
174
+
###Working with Individuals
174
175
175
-
### Gather the Fields
176
+
**Gather The Fields**
176
177
177
178
For this example we are going to use these fields:
178
179
@@ -184,7 +185,7 @@ For this example we are going to use these fields:
184
185
-`is_registrant` (boolean, default=True)
185
186
-`is_group` (boolean, default=False)
186
187
187
-
### Example: Create an Individual
188
+
**Example: Create an Individual**
188
189
189
190
```python
190
191
# First, get a gender_id (e.g., for "Male")
@@ -254,9 +255,9 @@ updated = response["result"]
254
255
print("Result:", updated)
255
256
```
256
257
257
-
##4. Working with Groups
258
+
###Working with Groups
258
259
259
-
### Required Fields
260
+
**Gather The Fields**
260
261
261
262
For this example we are going to use these fields:
262
263
@@ -266,7 +267,7 @@ For this example we are going to use these fields:
266
267
-`is_group` (boolean, default=True)
267
268
268
269
269
-
### Example: Create a Group
270
+
**Example: Create a Group**
270
271
271
272
```python
272
273
# Get a group kind (e.g., "Household")
@@ -333,9 +334,9 @@ updated = response["result"]
333
334
print("Result:", updated)
334
335
```
335
336
336
-
##5. Working with Memberships
337
+
###Working with Memberships
337
338
338
-
### Required Fields
339
+
**Gather The Fields**
339
340
340
341
From your `g2p_registry_membership` module, the main model is likely `g2p_registry_membership.group_membership`. Required fields typically include:
341
342
-`individuak` (many2one, required)
@@ -344,7 +345,7 @@ From your `g2p_registry_membership` module, the main model is likely `g2p_regist
344
345
-`start_date` (date, required)
345
346
- Any other required fields as defined in your model
Copy file name to clipboardExpand all lines: docs/developer_guide/module_development/registry.md
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ reviewer: migration-script
5
5
migration-notes: "Added during 2025 documentation reorganization"
6
6
---
7
7
8
-
# Customize the Registry
8
+
# Registry
9
9
10
10
This article explains how to customize OpenSPP's registry system by introducing a new **top-level group** type. As a practical example, we’ll add a new top-level group type (such as "Village") that can contain regular groups (households), along with custom UI, data, and actions.
11
11
@@ -422,6 +422,4 @@ Village A (Top Level Group)
422
422
For more information on extending OpenSPP modules, refer to:
0 commit comments