API Documentation

Endpoint: http://api.ayna.com/
Introduction Click to show

Your business is connected and Ayna makes that possible with a rich and growing set of API calls that connects your business to other services online.

If you need an API call and it is NOT listed here, please contact support and we will make it available for you

All Active API calls start with the current version of v1.

Auth: We use HTTP Digest Authentication. Please request an API key through support

Actions

Account /v1/:business_id/account

Account

Use this call to get basic account information about an Ayna business presence. Any authenticated user has access.

Allowed Methods: GET

GET Method

GET /v1/{{business_id}}/account.json

Returns:

1. business_id
2. business_name (Name of Business in English)
3. business_enabled (1 = yes, 0 = disabled)
4. business_type (1 = mall, 0 = single)
5. service_name (Name of Current Service Level)

JSON Response:

[{
    "business_id": "37447",
    "business_name": "Punto by Ayna",
    "business_enabled": "1",
    "business_type": "0",
    "service_name": "PUNTO"
}]
List /v1/:business_id/list

Parameters

Name Required
list_id

List

Use this call to get the subscriber informtion of an existing list that belong to an Ayna business presence. Any authenticated user has access.

Allowed Methods: GET

GET Method

GET /v1/{{business_id}}/list.json?list_id=1

Requires:

1. list_id (what list are we talking about?)

Returns:

1. id (subscriber id)
2. buiness_id
3. subscribe_phone (subscriber phone)
4. subscribe_email (subscriber email)
5. subscribe_name (subscriber full name)
6. subscribe_preferences (preferences - not used)
7. list_id (list id)
8. lastupdated (datetime of last update)

JSON Response:

[{
    "id": "1",
    "business_id": "37447",
    "subscribe_phone": "xxxxxx",
    "subscribe_email": "xxxxx",
    "subscribe_name": "xxxxxx",
    "subscribe_preferences": null,
    "list_id": "1",
    "lastupdated": "2013-01-25 20:08:56"
}, {
    "id": "72",
    "business_id": "37447",
    "subscribe_phone": "xxxxxx",
    "subscribe_email": "",
    "subscribe_name": "xxxxxx",
    "subscribe_preferences": null,
    "list_id": "1",
    "lastupdated": "2013-01-25 20:08:56"
}]
Lists /v1/:business_id/lists

Lists

Use this call to get the names and ids of lists that belong to an Ayna business presence. Any authenticated user has access.

Allowed Methods: GET

GET Method

GET /v1/{{business_id}}/lists.json

Returns:

1. id (list id)
2. list_name (list name)
3. business_id (business_id)

JSON Response:

[{
"id": "1",
"list_name": "Developer Newsletter",
"business_id": "37447"

}, {
"id": "22",
"list_name": "EMEA Newsletter",
"business_id": "37447"
}, {
"id": "66",
"list_name": "Ayna Corporation Newsletter",
"business_id": "37447"
}]

Subscriber /v1/:business_id/subscriber

Parameters

Name Required
list_id
user_email
user_name
user_mobile

Subscriber

Use this call to manage single subscriptions and synchronize between ayna group lists and external ones such as mailchimp, activecampaign etc... Any authenticated user has access.

Allowed Methods: GET POST DELETE

POST Method (Add a Subscriber to a list)

POST /v1/{{business_id}}/subscriber.json

Requires:

1. list_id
2. user_email
3. user_name
4. user_mobile

Returns:

DELETE Method (Delete will remove the subscriber from a list)

DELETE /v1/{{business_id}}/subscriber.json

Requires:

1. list_id
2. user_email

Returns:

GET Method (Retrieve user information for a given list)

GET /v1/{{business_id}}/subscriber.json

Requires:

1. list_id
2. user_email

Returns:

1. business_id
2. user_email
3. user_mobile
4. user_name
5. list_id

JSON Response:

When found...

[{
"business_id": "37447",
"user_email": "xxxxx",
"user_mobile": "111222333444",
"user_name": "xxxxx",
"list_id": "1"
}]

when NOT found...
{"error":"Not found"}

Errors

401 NO_DELETE

Description

This error is returned whenever a collection or a resource prevents the use of the DELETE method.

Error Message

DELETE calls are not accepted for this request.

401 NO_GET

Description

This error is returned whenever a collection or a resource prevents the use of the GET method.

Error Message

GET calls are not accepted for this request.

401 NO_POST

Description

This error is returned whenever a collection or a resource prevents the use of the POST method.

Error Message

POST calls are not accepted for this request.

401 NO_PUT

Description

This error is returned whenever someone tries to execute a PUT request on a collection or a resource that prevents PUT requests.

Error Message

PUT calls are not accepted for this request.

401 NO_USER

Description

Could not find user email in database

Error Message

Could not find user email in database

403 NOT_AUTHORIZED

Error Message

Permissions do not add up, please check your business_id

Output Formats / Mimetypes

html text/html
js text/javascript | application/javascript
json application/json | text/json | text/plain
printr text/php-printr
xml text/xml | application/xml