|
| 1 | +# API Documentation for Map Groups |
| 2 | + |
| 3 | +Disclaimer: This document was bootstrapped using Github Copilot and GPT-4o. The content has been re-written for accuracy. |
| 4 | + |
| 5 | +The Map Groups module uses JavaScript Object Notation - Remote Procedure Call ('JSON-RPC') 2.0 to manage its API. |
| 6 | + |
| 7 | +In brief, this means all RPC API calls for the Madrona portal this module is included in, as well as for any other modules that use RPC, use the same endpoint: `/rpc`. |
| 8 | + |
| 9 | +The requests to this endpoint should be structured with the following request content: |
| 10 | +``` |
| 11 | +{ |
| 12 | + id: (int), |
| 13 | + jsonrpc: 2.0, |
| 14 | + method: (string), |
| 15 | + params: (array) |
| 16 | +} |
| 17 | +``` |
| 18 | +Use the documentation below to identify which `method` value to use, what `id` is used to represent, and whether any parameters should be included in your `params` array. |
| 19 | + |
| 20 | +## JSON-RPC endpoint for mapgroups |
| 21 | + |
| 22 | +You may view a summary of all RPC methods available on a given Madrona Portal instance by opening the `/rpc` endpoint in a browser (no request content needed). |
| 23 | + |
| 24 | +### method: get_sharing_groups |
| 25 | + |
| 26 | +**Description:** Retrieves the sharing groups for the logged-in user. |
| 27 | +- requires a valid CSRF token and sessionid in the cookies |
| 28 | + |
| 29 | +**Request Body:** |
| 30 | +- Required: |
| 31 | + - `method:'get_sharing_group'`: Tells RPC to use this method. |
| 32 | +- Optional: |
| 33 | + - `id`: does nothing |
| 34 | + - `jsonrpc`: supports 2.0 by default |
| 35 | + - `params`: empty array by default (none available) |
| 36 | + |
| 37 | +**Returns:** A list of sharing groups with the following fields: |
| 38 | +- `group_name`: The name of the group. |
| 39 | +- `group_slug`: The slug of the group. |
| 40 | +- `members`: A list of members in the group. |
| 41 | +- `is_mapgroup`: A boolean indicating if it is a map group. |
| 42 | + |
| 43 | +**Example Response:** |
| 44 | +```json |
| 45 | +{ |
| 46 | + "jsonrpc": "2.0", |
| 47 | + "id": "", |
| 48 | + "result": [ |
| 49 | + { |
| 50 | + "group_name": "Testing", |
| 51 | + "group_slug": "testingQB55t05q", |
| 52 | + "members": [ |
| 53 | + "Bill", |
| 54 | + "Ted" |
| 55 | + ], |
| 56 | + "is_mapgroup": true |
| 57 | + }, |
| 58 | + { |
| 59 | + "group_name": "A private group", |
| 60 | + "group_slug": "a-private-groupTIG1doWy", |
| 61 | + "members": [ |
| 62 | + "Bill" |
| 63 | + ], |
| 64 | + "is_mapgroup": true |
| 65 | + }, |
| 66 | + { |
| 67 | + "group_name": "Share with Public", |
| 68 | + "group_slug": "Share with Public", |
| 69 | + "members": [], |
| 70 | + "is_mapgroup": false |
| 71 | + } |
| 72 | + ] |
| 73 | +} |
| 74 | +``` |
| 75 | + |
| 76 | +### method: update_map_group [DEPRECATED] |
| 77 | + |
| 78 | +**Description:** Updates the details of a map group. |
| 79 | +- requires a valid CSRF token and sessionid in the cookies |
| 80 | + |
| 81 | +**Parameters:** |
| 82 | +- `group_id`: The ID of the group to update. |
| 83 | +- `options`: A dictionary of options to update. |
| 84 | +- `kwargs`: Additional keyword arguments. |
| 85 | + |
| 86 | + |
0 commit comments