Skip to content

Commit

Permalink
GitBook: [master] 2 pages modified
Browse files Browse the repository at this point in the history
  • Loading branch information
jordan-wright authored and gitbook-bot committed Oct 9, 2018
1 parent f1454c3 commit 6e8f508
Show file tree
Hide file tree
Showing 2 changed files with 211 additions and 3 deletions.
2 changes: 1 addition & 1 deletion SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
* [Sending Profiles](sending-profiles.md)
* [Templates](templates.md)
* [Landing Pages](landing-pages.md)
* [Campaigns](campaigns.md)
* [Users & Groups](users-and-groups.md)
* [Campaigns](campaigns.md)

212 changes: 210 additions & 2 deletions users-and-groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down Expand Up @@ -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.

0 comments on commit 6e8f508

Please sign in to comment.