Account users - Heyloyalty/api GitHub Wiki

Important! requires a reseller account.

How to become a reseller

When issuing calls to the Heyloyalty Partner API you will be able to manage your partner accounts, by creating, editing, deleting and viewing usage. You will also be able to manage user accessibility for your accounts, by creating, editing or deleting partner account users.

Endpoint: https://api.heyloyalty.com/reseller

All examples assumes that you are authenticated prior to usage.
Please see how to authenticate in the Getting started section.

Get account users

Gets all user by account id

GET /accounts/:id/users

Parameters

This method takes no parameters

Example

Get all users with account id 1

http://api.heyloyalty.com/reseller/accounts/1/users

Response

Status 200 ok


[
    {
        "id": "1",
        "is_admin": "1",
        "is_shop": null,
        "role_id": "1",
        "name": "John",
        "email": "[email protected]",
        "system_language_id": "1",
       "reference_id": "1",
        "timezone_id": "326",
        "created_at": "2014-01-01 00:00:00",
        "updated_at": "2014-01-01 00:00:00"
    }
]

Error response

Account doesn't exist
Status 404 account not found

Get a single account user

Gets a user by account id and user id

GET /accounts/:id/users/:id

Parameters

This method takes no parameters

Example

Get a user with account id 1 and user id 1

http://api.heyloyalty.com/reseller/accounts/1/users/1

Response

Status 200 ok


{
    "id": "1",
    "is_admin": "1",
    "is_shop": null,
    "role_id": "1",
    "name": "John",
    "email": "[email protected]",
    "system_language_id": "1",
   "reference_id": "1",
    "timezone_id": "326",
    "created_at": "2014-01-01 00:00:00",
    "updated_at": "2014-01-01 00:00:00"
}

Error response

Account don't excist
Status 404 account not found

User not found
Status 404 user not found

Create an account user

Creates a new user on an account

POST /accounts/:id/users

Parameters

Name Description Type Required
name name on the user string x
email email on the user string x
password password on the user, minimum 8 characters string x

Example

Creates a user on account with id 1

 http://api.heyloyalty.com/reseller/account/1/users/?name=john doe&[email protected]&password=cHx0f7BB&reference_id=SB-1232

Response

On success returns the new user id

Status 200 ok

{ "id": 2 }

Error response

Account don't excist
Status 404 account not found

Missing fields


{
    "name": [
        "The name field is required."
    ],
    "email": [
        "The email field is required."
    ],
    "password": [
        "The password field is required."
    ]
}

Edit an account user

Edits a user on an account

PUT /accounts/:id/users/:id

Parameters

See create a user for parameters

Example

Updates a user with account id 1 and user id 2

http://api.heyloyalty.com/reseller/accounts/1/users /2/?name=John Doe&[email protected]&password=hgyt9J36Hi&reference_id=SB-2332

Response

Status 204 on content

Error response

Account don't excist
Status 404 account not found

User don't excist
Status 404 user not found

Missing fields


{
    "name": [
        "The name field is required."
    ],
    "email": [
        "The email field is required."
    ],
    "password": [
        "The password field is required."
    ]
}

Delete an account user

Deletes a user on an account

Warning: this action can NOT be undone.
DELETE /accounts/:id/users/:id

Parameters

This method takes no parameters

Example

Deletes a user on account with id 1 and user id 2

http://api.heyloyalty.com/reseller/accounts/1/users/1

Response

Status 204 on content

Error response

Account don't excist
Status 404 account not found

User don't excist
Status 404 user not found

⚠️ **GitHub.com Fallback** ⚠️