Accounts - Heyloyalty/api GitHub Wiki

Warning! requires 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.

Partner API URL: https://api.heyloyalty.com/reseller

All examples assumes that you are already authenticated. see how to authenticate

Get accounts

Show accounts related to reseller id

 GET /accounts 

Parameters

Method accepts no parameters

Example

Gets all accounts related to a reseller id

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

Response

Status 200 ok


[
    {
        "id": "1",
        "type": "active",
        "name": "Loyalitets Bureauet",
        "firstname": "John",
        "lastname": "Doe",
        "mobile": "88888888",
        "phone": "88888888",
        "address": "Jens Baggesensvej 47",
        "address_2": null,
        "zipcode": "8200",
        "city": "Århus N",
        "cvr_no": "1234567890",
        "created_at": "2014-01-01 00:00:00",
    }
]

Error response

No account
Status 404 not found

Get a single account

Gets information about a single account

 GET /accounts/:id 

Parameters

This method takes no parameters.

Example

Get account information from account with id of 1.

 https://api.heyloyalty.com/reseller/accounts/1 

Response

Status 200 ok


{
    "id": "1",
    "type": "active",
    "name": "Loyalitets Bureauet",
    "firstname": "Loyalitets",
    "lastname": "Bureauet",
    "mobile": "88888888",
    "phone": "88888888",
    "address": "Jens Baggesensvej 47",
    "address_2": null,
    "zipcode": "8200",
    "city": "Århus N",
    "cvr_no": "1234567890",
    "api_secret": "e9433d45eead594a721cf30adcf35d70",
    "api_key": "5a0f2d5629afa615",
    "notes": []
}

Error response

No account
Status 404 not found

Get a single account usage

Gets the accounts usage

 GET /accounts/:id/usage 

Parameters

Name Description Type
from YYYY-MM-DD H:I:S datetime
to YYYY-MM-DD H:I:S datetime

Examples

Gets an account usage with id 1 and within a time range

 https://api.heyloyalty.com/reseller/accounts/1/usage/?from=2014-01-01 00:00:00&to=2014-02-12 00:00:00 

Response

Status 200 ok


{
    "campaign": {
        "email": [],
        "sms": []
    },
    "autoresponder": {
        "email": [],
        "sms": []
    },
    "sms_countries": []
}

Error response

Account doesn't exist
Status 404 account not found

Create an account

Creates a new account

 POST /accounts 

Parameters

Name Description Type Required
name account name string x
firstname account firname string
lastname account lastname string
mobile account mobile int
phone account phone int
address account address string
address_2 account address 2 string
zipcode account zipcode string
city account city string
cvr_no your company cvr number int
type active, demo, freemium or suspended string x

Examples

Minimum parameters for creating an account.

 https://api.heyloyalty/reseller/?name=myaccount 

All parameters for creating an account.

 https://api.heyloyalty.com/reseller/name=myaccount&firstname=my&lastname=account&mobile=00000000&phone=00000000&address=st sct Andrews 58&address_2=st road 41&zipcode=12000&city=mycity&cvr_no=123456789 

Response

The id of the new account is returned

Status 201 Created

 { id:1 } 

Error response

Missing fields

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

Edit an account

Updates an account with the specified parameters, parameters not specified will not be updated.

 PUT /accounts/:id 

Parameters

See create an account for other parameters

Examples

Updates an account name

 https://api.heyloyalty.com/reseller/accounts/1/?name=MyCompany 

Suspend an account

 https://api.heyloyalty.com/reseller/accounts/1/?name=MyCompany&type=suspended 

Response

Status 204 no content

Error response

Account don't excist
Status 404 account not found

Delete an account

Deletes an account

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

Parameters

This method takes no parameters

Example

Deletes an account with 1 as id.

https://api.heyloyalty.com/reseller/accounts/1

Response

Status 204 no content

The method does not return anything on success

Error response

Account don't excist
Status 404 account not found

Heypush feature on an account

Does account have heypush / adds heypush / removes heypush

 GET /accounts/:id/heypush 

Parameters

This method takes no parameters

Example

Checks if an account with 1 as id has heypush.

https://api.heyloyalty.com/reseller/accounts/1/heypush

Response

Status 200 ok

"Account has webpush"

Error response

Status 404 not found

"No webpush active on account"
 POST /accounts/:id/heypush 

Parameters

This method takes no parameters

Example

Adds heypush to an account with 1 as id.

https://api.heyloyalty.com/reseller/accounts/1/heypush

Response

Status 200 ok

The method does not return anything on success

 DELETE /accounts/:id/heypush 

Parameters

This method takes no parameters

Example

Deletes heypush on an account with 1 as id.

https://api.heyloyalty.com/reseller/accounts/1/heypush

Response

Status 200 ok

The method does not return anything on success

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