Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

This topic might be out-of-date and is replaced by the following:

In this Article

Table of Contents
maxLevel2
excludeOlder Versions|Additional Resources|Related Links|Related Information

Overview

User and Group APIs enable you as an Org admin to perform operations on users and groups in a SnapLogic Org.

...

Note

Any user can retrieve their own user data, but only Org admins can see other users and are able to make any modifications.

Authentication

The API authenticates requests using basic authentication over HTTPS. Support for more authentication methods is under consideration for future updates.

Note

If you are using the REST Snaps to access the SnapLogic API, you will need to create a REST account with your SnapLogic credentials.

User API

  • Creating a User (POST)

  • Fetching Information

    • Get Users by Email (GET)

    • Get Users by Org (GET)

  • Updating a User (PUT)

  • Deleting a User (DELETE)

Create User

This is a POST-type request to create a new user. Only Org admins can use this API. The response from such a call is a document displaying details of the user.

API

Paste code macro
POST /api/1/rest/public/users

Syntax

Paste code macro
REST Client:
POST https://<pod_name>/api/1/rest/public/users

cURL Command:
POST /api/1/rest/public/users HTTP/1.1
Host: <pod_name>
Authorization: Basic <bearer_token>
Cache-Control: no-cache
Content-Type: application/json

Parameters

Key

Description

email

String. Specifies the user's email.

first_name

String. Specifies the user's first name.

last_name

String. Specifies the user's last name. 

organization

String. Specifies the name of the organization in which to place the user.

administrator

Boolean. Specifies whether the user is an administrator.

allow_password_login

Boolean. Specifies whether the user can login with password.

create_home_directory

Boolean. Specifies whether a default project is to be created for the user. The path is

Paste code macro
/<org_name>/projects/<first_name> <last_name>


ui_access

Boolean. Specifies whether the user has access to the UI. This value is set to false of service accounts.

email_notification

Boolean. Specifies whether the user receives a welcome email notification when an account is created.

utility

Boolean. Creates the user as a service account.

Example

Paste code macro
Request:
POST https://uat.elastic.snaplogic.com/api/1/rest/public/users

Request Body: 
{
 "email":"john.doe@test.com",
 "first_name":"John",
 "last_name":"Doe",
 "organization":"Test_Org",
 "administrator":false,
 "ui_access":true,
 "allow_password_login":true,
 "create_home_directory":false
}

Response:
{
 "last_name": "Doe", 
 "password_last_updated": "2018-11-20T09:00:18.004000+00:00", 
 "password_expired": false, 
 "allow_password_login": true, 
 "first_name": "John", 
 "basic_access": null, 
 "ui_access": true, 
 "user_locked_out": true, 
 "service_account": false, 
 "email": "john.doe@test.com",
 “organizations”: [organization document, ...]
}

Organization document
{
 “id”: “12345d1eiqdracdf4f8c7153”
 “name”: “Test_Org”,
 “administrator”: false,
}


Info

Basic Access

The basic_access field in the returned user document records the last time (in UTC ISO-8601 format) that a user accessed the REST API using basic authentication. When the REST API is accessed for the first time, the value might be null.


Retrieve Users by Email

Fetches user data for the specified Email. 

API

Paste code macro
GET /api/1/rest/public/users/<email_address>

Syntax

Paste code macro
REST Client:
GET https://<pod_name>/api/1/rest/public/users/<email_address>

cURL Command:
GET /api/1/rest/public/users/<email_address> HTTP/1.1
Host: <pod_name>
Authorization: Basic <bearer_token>
Cache-Control: no-cache

Parameters

Not applicable.

Examples

Paste code macro
Request:
GET https://uat.elastic.snaplogic.com/api/1/rest/public/users/john.doe@test.com

Response:
{
 "last_name": "Doe", 
 "password_last_updated": "2017-01-20T11:19:55.535000+00:00", 
 "password_expired": false, 
 "allow_password_login": true, 
 "first_name": "John", 
 "basic_access": null, 
 "ui_access": true, 
 "user_locked_out": false, 
 "service_account": false, 
 "email": "john.doe@test.com"
}

Retrieve Members List for an Organization

Retrieves a list of members within an Org segregated by group.

API

Paste code macro
GET /api/1/rest/public/groups/<org_name>/members

Syntax

Paste code macro
REST Client:
GET https://<pod_name>/api/1/rest/public/groups/<org_name>/members

cURL Command:
GET /api/1/rest/public/groups/<org_name>/members HTTP/1.1
Host: <pod_name>
Authorization: Basic <bearer_token>
Cache-Control: no-cache

Parameters

Not applicable.

Examples

Paste code macro
Request:
GET https://uat.elastic.snaplogic.com/api/1/rest/public/groups/Test_Org/members

Response:
 {"name": "members", "members": [ "john.doe@test.com", "mary.doerina@test.com", "johnathan.doe@test.com" ] }

Update a User

Updates data of the specified user.

API

Paste code macro
PUT /api/1/rest/public/users/<email_address>

Syntax

Paste code macro
REST Client:
PUT https://<pod_name>/api/1/rest/public/users/<email_address>

cURL Command:
PUT /api/1/rest/public/users/<email_address> HTTP/1.1
Host: <pod_name>
Authorization: Basic <bearer_token>
Cache-Control: no-cache
Content-Type: application/json

Parameters

Key

Description

first_name

String. Specifies the user's first name.

last_name

String. Specifies the user's last name.

allow_password_login

Boolean. Specifies whether the user can login with a password.

ui_access

Boolean. Specifies whether the user has access to the UI. This value is set to false of service accounts.

created_by

String. Specifies the user who originally created the service account. This parameter enables an Org admin to change the user who originally created the service account in cases where the password recovery email for that user needs to be reset. You cannot specify the current Service Account user with this parameter.

  • The user who calls this API must be Org admin (org_admin).

  • The target user must be a service account user.

  • The target user in the "created_by" value must be an Org admin of the updated user's Org.

For details, see Creating a User

Examples

Paste code macro
Request:
PUT https://uat.elastic.snaplogic.com/api/1/rest/public/users/john.doe@test.com

Request Body:
{
 "email":"new.johndoe@test.com",
 "first_name":"Mr John",
 "last_name":"Doeser",
 "organization":"Test_Org2",
 "administrator":false,
 "ui_access":true,
 "allow_password_login":true,
 "create_home_directory":false
}

Response:
{
 "last_name": "Doeser", 
 "password_last_updated": "2017-01-20T11:19:55.535000+00:00", 
 "password_expired": false, 
 "allow_password_login": true, 
 "first_name": "Mr John", 
 "basic_access": null, 
 "ui_access": true, 
 "user_locked_out": false, 
 "service_account": false, 
 "email": "new.johndoe@test.com"
}

Delete a User

Deletes a user from the database. To successfully perform this action, you need to be an admin on all of the user's orgs.


Warning

This delete action permanently removes the user from the system (unlike the SnapLogic user interface that only deletes a user from the org, but not from the system). To check if a user exists in other orgs (before deleting), use the PATCH /api/1/rest/public/groups/{organization}/{name} option on the user group of your org. 


API

Paste code macro
DELETE /api/1/rest/public/users/{email}

Syntax

Paste code macro
REST Client:
DELETE https://<pod_name>/api/1/rest/public/users/<email_address>

cURL Command:
DELETE /api/1/rest/public/users/<email_address> HTTP/1.1
Host: <pod_name>
Authorization: Basic <bearer_token>
Cache-Control: no-cache

Parameters

Not applicable.

Examples

Paste code macro
Request:
https://uat.elastic.snaplogic.com/api/1/rest/public/users/john.doe@test.com

Response:
{
 “success”: “ok”
}

Group API

  • Creating a group

  • Fetching a group's information

  • Fetching information of all groups in an Org

  • Updating members' list

  • Adding members in a group

  • Removing members from a group

  • Deleting a group

Create a Group

To create a group and add members to it, you must do two API calls. Use this API to create the group. To add members to the group, make this API call again using the Members parameter. 

Note

Org and Groups

This API does not check if the Org within which you plan to add the target group and users exists. Therefore, verify first that the Org is created, then create the group first, then add the members.


Info

Group Names

We recommend you do not insert spaces in your Group name; instead, use an underscore.


API

Paste code macro
POST /api/1/rest/public/groups

Syntax

Paste code macro
REST Client:
POST https://<pod_name>/api/1/rest/public/groups

cURL Command:
POST /api/1/rest/public/groups HTTP/1.1
Host: <pod_name>
Authorization: Basic <bearer_token>
Cache-Control: no-cache
Content-Type: application/json


Parameters

Key

Description

organization

String. Specifies the name of the organization within which the group is to be created.

name

String. Specifies the name of the group. This value has to be unique within the Org.

members

List. Specifies a list of the user's email belonging to the group.

Examples

Paste code macro
Request:
POST https://uat.elastic.snaplogic.com/api/1/rest/public/groups

Request Body:
{
 "organization":"Test_Org",
 "name":"Test_Group",
 "members":[
            "john.doe@test.com"
           ]
}

Response:
{
 "name": "TestGroup", 
 "members":[
            "john.doe@test.com"
           ]
}

Retrieve Groups by Organization

Retrieve an Org’s groups.

API

Paste code macro
GET /api/1/rest/public/groups/<org_name>

Syntax

Paste code macro
REST Client:
GET https://<pod_name>/api/1/rest/public/groups/<org_name>

cURL Command:
GET /api/1/rest/public/groups/<org_name> HTTP/1.1
Host: <pod_name>
Authorization: Basic <bearer_token>
Cache-Control: no-cache

Parameters

Not applicable.

Examples

Paste code macro
Request:
GET https://uat.elastic.snaplogic.com/api/1/rest/public/groups/Test_Org

Response:
{
 “groups”: [
            Test_Group1, 
            Test_Group2,
            …
           ]
}

Retrieve Group by Name

Fetches all information for the specified group.

API

Paste code macro
GET /api/1/rest/public/groups/<org_name>/<group_name>

Syntax

Paste code macro
REST Client:
GET https://<pod_name>/api/1/rest/public/groups/<org_name>/<group_name>

cURL Command:
GET /api/1/rest/public/groups/<org_name>/<group_name> HTTP/1.1
Host: <pod_name>
Authorization: Basic <bearer_token>
Cache-Control: no-cache

Parameters

Not applicable.

Examples

Paste code macro
Request:
GET https://uat.elastic.snaplogic.com/api/1/rest/public/groups/Test_Org/Test_Group
	
Response: 
{
 "name": "Test_Group", 
 "members": [
              "john.doe@test.com", 
              "mary.doerina@test.com", 
              "johnathan.doe@test.com"
            ]
}

Update Members List

Updates the members list of the specified group in the specified Org. Each time this call is executed, the members list is overwritten.

API

Paste code macro
PUT /api/1/rest/public/groups/<org_name>/<group_name>

Syntax

Paste code macro
REST Client:
PUT https://<pod_name>/api/1/rest/public/groups/<org_name>/<group_name>

cURL Command:
PUT /api/1/rest/public/groups/<org_name>/<group_name> HTTP/1.1
Host: <pod_name>
Authorization: Basic <bearer_token>
Cache-Control: no-cache
Content-Type: application/json

Parameters

Key

Description

members

List. Members in the group, the existing members list is overwritten.

Examples

Paste code macro
Request:
PUT https://uat.elastic.snaplogic.com/api/1/rest/public/groups/Test_Org/Test_Group

Request Body: 
{
 "organization":"Test_Org",
 "name":"Test_Group",
 "members":[
            "john.doe@test.com", 
            "john.doerina@test.com", 
            "mary.doe@test.com", 
            "johnny.dope@test.com"
           ]
}

Response:
{
 "name": "TestGroup", 
 "members":[
            "john.doe@test.com", 
            "john.doerina@test.com", 
            "mary.doe@test.com", 
            "johnny.dope@test.com"
           ]
}

Add/Remove a Group

Add/remove group, and add or remove users from that group.

API

Paste code macro
PATCH /api/1/rest/public/groups/<org_name>/<group_name>

Syntax

Paste code macro
REST Client:
PATCH https://<pod_name>/api/1/rest/public/groups/<org_name>/<group_name>

cURL Command:
PATCH /api/1/rest/public/groups/<org_name>/<username> HTTP/1.1
Host: <pod_name>
Authorization: Basic <bearer_token>
Cache-Control: no-cache

Parameters

Key

Description

add_user

String. Specifies the email of the user to be added to the group.

remove_user

String. Specifies the email of the user to be removed from the group.

...

Info

Only one of the above parameters can be used at a time.

Examples

Paste code macro
Request
PATCH https://uat.elastic.snaplogic.com/api/1/rest/public/groups/Test_Org/Test_Group

Request Body:
{
 "add_user":"johnny.dope@test.com"
}

Response:
{
 "name": "Test_Group", 
 "members": [
             "john.doe@test.com", 
             "john.doerina@test.com", 
             "mary.doe@test.com", 
             "johnny.dope@test.com"
            ]
}


Info

Use Members to add a user

You can add an existing user to an Org by adding the user to the Members group.

Delete Group

Deletes the specified group from the specified Org. 

API

Paste code macro
DELETE /api/1/rest/groups/<org_name>/<group_name>

Syntax

Paste code macro
REST Client:
DELETE https://<pod_name>/api/1/rest/groups/<org_name>/<group_name>

cURL Command:
DELETE /api/1/rest/groups/<org_name>/<group_name> HTTP/1.1
Host: <pod_name>
Authorization: Basic <bearer_token>
Cache-Control: no-cache

Parameters

Not applicable.

Examples

Paste code macro
Request
DELETE https://uat.elastic.snaplogic.com/api/1/rest/public/groups/Test_Org/Test_Group

Response:
{
 “success”: “ok”
}

Using REST Snaps to Execute APIs

You can execute the following APIs using pipelines:

...