-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f1454c3
commit 6e8f508
Showing
2 changed files
with
211 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -264,8 +264,8 @@ A valid API key | |
{% endapi-method-headers %} | ||
|
||
{% api-method-body-parameters %} | ||
{% api-method-parameter name="Payload" type="string" required=true %} | ||
The group to create in JSON format. See the introduction for the group format. | ||
{% api-method-parameter name="Payload" type="object" required=true %} | ||
The group to create in JSON format. | ||
{% endapi-method-parameter %} | ||
{% endapi-method-body-parameters %} | ||
{% endapi-method-request %} | ||
|
@@ -338,3 +338,211 @@ When creating a new group, you must specify a unique `name`, as well as a list o | |
} | ||
``` | ||
|
||
{% api-method method="put" host="https://localhost:3333" path="/api/groups/:id" %} | ||
{% api-method-summary %} | ||
Modify Group | ||
{% endapi-method-summary %} | ||
|
||
{% api-method-description %} | ||
Modifies a group. | ||
{% endapi-method-description %} | ||
|
||
{% api-method-spec %} | ||
{% api-method-request %} | ||
{% api-method-path-parameters %} | ||
{% api-method-parameter name="id" type="integer" required=true %} | ||
The group ID | ||
{% endapi-method-parameter %} | ||
{% endapi-method-path-parameters %} | ||
|
||
{% api-method-headers %} | ||
{% api-method-parameter name="Authorization" type="string" required=true %} | ||
A valid API key | ||
{% endapi-method-parameter %} | ||
{% endapi-method-headers %} | ||
|
||
{% api-method-body-parameters %} | ||
{% api-method-parameter name="Payload" type="object" required=true %} | ||
The updated group content. The full group must be provided in JSON format. | ||
{% endapi-method-parameter %} | ||
{% endapi-method-body-parameters %} | ||
{% endapi-method-request %} | ||
|
||
{% api-method-response %} | ||
{% api-method-response-example httpCode=200 %} | ||
{% api-method-response-example-description %} | ||
|
||
{% endapi-method-response-example-description %} | ||
|
||
```javascript | ||
{ | ||
"id": 1, | ||
"name": "Example Modified Group", | ||
"modified_date": "2018-10-08T15:56:13.790016Z", | ||
"targets": [ | ||
{ | ||
"email": "[email protected]", | ||
"first_name": "Foo", | ||
"last_name": "Bar", | ||
"position": "" | ||
} | ||
] | ||
} | ||
``` | ||
{% endapi-method-response-example %} | ||
|
||
{% api-method-response-example httpCode=404 %} | ||
{% api-method-response-example-description %} | ||
|
||
{% endapi-method-response-example-description %} | ||
|
||
```javascript | ||
{ | ||
"message": "Group not found", | ||
"success": false, | ||
"data": null | ||
} | ||
``` | ||
{% endapi-method-response-example %} | ||
{% endapi-method-response %} | ||
{% endapi-method-spec %} | ||
{% endapi-method %} | ||
|
||
This API endpoint allows you to modify an existing group. The request must include the complete group JSON, not just the fields you're wanting to update. This means that you need to include the matching `id` field. Here's an example request: | ||
|
||
```javascript | ||
{ | ||
"id": 1, | ||
"name": "Example Modified Go", | ||
"targets": [ | ||
{ | ||
"email": "[email protected]", | ||
"first_name": "Foo", | ||
"last_name": "Bar", | ||
"position": "" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
Returns a 404 if no group is found with the provided ID. | ||
|
||
{% api-method method="delete" host="https://localhost:3333" path="/api/groups/:id" %} | ||
{% api-method-summary %} | ||
Delete Group | ||
{% endapi-method-summary %} | ||
|
||
{% api-method-description %} | ||
Deletes a group | ||
{% endapi-method-description %} | ||
|
||
{% api-method-spec %} | ||
{% api-method-request %} | ||
{% api-method-path-parameters %} | ||
{% api-method-parameter name="id" type="number" required=true %} | ||
The group ID | ||
{% endapi-method-parameter %} | ||
{% endapi-method-path-parameters %} | ||
|
||
{% api-method-headers %} | ||
{% api-method-parameter name="Authorization" type="string" required=true %} | ||
A valid API key | ||
{% endapi-method-parameter %} | ||
{% endapi-method-headers %} | ||
{% endapi-method-request %} | ||
|
||
{% api-method-response %} | ||
{% api-method-response-example httpCode=200 %} | ||
{% api-method-response-example-description %} | ||
|
||
{% endapi-method-response-example-description %} | ||
|
||
```javascript | ||
{ | ||
"message": "Group deleted successfully!", | ||
"success": true, | ||
"data": null | ||
} | ||
``` | ||
{% endapi-method-response-example %} | ||
|
||
{% api-method-response-example httpCode=404 %} | ||
{% api-method-response-example-description %} | ||
|
||
{% endapi-method-response-example-description %} | ||
|
||
```javascript | ||
{ | ||
"message": "Group not found", | ||
"success": false, | ||
"data": null | ||
} | ||
``` | ||
{% endapi-method-response-example %} | ||
{% endapi-method-response %} | ||
{% endapi-method-spec %} | ||
{% endapi-method %} | ||
|
||
Returns a 404 error if no group is found with the provided ID. | ||
|
||
{% api-method method="post" host="https://localhost:3333" path="/api/import/group" %} | ||
{% api-method-summary %} | ||
Import Group | ||
{% endapi-method-summary %} | ||
|
||
{% api-method-description %} | ||
Reads and parses a CSV, returning data that can be used to create a group. | ||
{% endapi-method-description %} | ||
|
||
{% api-method-spec %} | ||
{% api-method-request %} | ||
{% api-method-headers %} | ||
{% api-method-parameter name="Authorization" type="string" required=true %} | ||
A valid API key | ||
{% endapi-method-parameter %} | ||
{% endapi-method-headers %} | ||
|
||
{% api-method-body-parameters %} | ||
{% api-method-parameter name="file" type="object" required=true %} | ||
A file upload containing the CSV content to parse. | ||
{% endapi-method-parameter %} | ||
{% endapi-method-body-parameters %} | ||
{% endapi-method-request %} | ||
|
||
{% api-method-response %} | ||
{% api-method-response-example httpCode=200 %} | ||
{% api-method-response-example-description %} | ||
|
||
{% endapi-method-response-example-description %} | ||
|
||
```javascript | ||
[ | ||
{ | ||
"email": "[email protected]", | ||
"first_name": "Example", | ||
"last_name": "User", | ||
"position": "Systems Administrator" | ||
}, | ||
{ | ||
"email": "[email protected]", | ||
"first_name": "John", | ||
"last_name": "Doe", | ||
"position": "CEO" | ||
} | ||
] | ||
``` | ||
{% endapi-method-response-example %} | ||
{% endapi-method-response %} | ||
{% endapi-method-spec %} | ||
{% endapi-method %} | ||
|
||
This API endpoint allows you to upload a CSV, returning a list of group targets. For example, you can use the following `curl` command to upload the CSV: | ||
|
||
```text | ||
curl -k https://localhost:3333/api/import/group -XPOST \ | ||
-F "file=@group_template.csv" \ | ||
-H "Authorization: Bearer 0123456789abcdef" | ||
``` | ||
|
||
The results of this API endpoint can be used as the `targets` parameter in a call to the [Create Group](users-and-groups.md#create-group) endpoint. | ||
|