adding add‐ons to accounts using API - Heyloyalty/api GitHub Wiki

You need a reseller account and access, to use this feature. It's meant to let you add "add-ons" to an existing account, which you're the active reseller for, from your backend.

Example for Endpoints can be found below.

##List add-ons currently available

GET /reseller/paidfeatures

Response: 200 OK JSON:


[
{
"name": "ThisIsAnAddOn",
"id": 1
},
{
"name": "ThisIsAnotherAddOn",
"id": 8
}
]

##List add-ons on account

GET /reseller/paidfeatures/account/{accountId}

Response: 200 OK JSON:


[
{
"id": 1,
"name": "AwesomeFeature1"
},
{
"id": 2,
"name": "AwesomeFeature2"
}
]

If given wrong featureId:

Errors:

400 Bad Request: "Invalid id specified"

##Assign add-on to account

POST /reseller/paidfeatures/assign JSON Body:


{
"accountId": 1,
"featureId": 2
}

Response: 204 OK empty response

Errors:

400 Bad Request: "Invalid id specified"

400 Bad Request: "Invalid feature specified"

400 Bad Request: "Paid feature already connected to this account"

##Get accounts with a specific add-on

GET reseller/paidfeatures/listAccounts/{featureId}


[
{
"name": "Heyloyalty account",
"id": 1
}
]

Errors:

400 Bad Request: "Invalid feature specified"

##Delete an add-on from an account:

DELETE reseller/paidfeatures/{featureId}/{accountId}

Response 204 OK empty response

Errors:

400 Bad Request: "Invalid id specified"

400 Bad Request: "Invalid feature specified"

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