Get Credit Transactions

REQUEST
GET /request=creditTransactions&days=<days>

RESPONSE
200 OK
[
{
id: 5fkiswe7ntigf93,
dateTimeUTC: 2018-12-01T12:06:09Z,
ticketCurrency: USD,
ticketPrice: 0.1,
type: ADD_SERVICES,
details: {
unitCost: mo,
agentQuantity: 7,
agentCost: 2,
channelBasicQuantity: 3,
channelBasicCost: 50,
refMonth: 12
},
amount: -164
},
{
id: h95tg7erk3j43e5,
dateTimeUTC: 2018-11-16T09:45:12Z,
ticketCurrency: USD,
ticketPrice: 0.1,
type: ADD_SERVICES,
details: {
unitCost: mo,
agentQuantity: 3,
agentCost: 2,
channelBasicQuantity: 1,
channelBasicCost: 50,
refMonth: 11,
paidDays: 15
},
amount: -28
},
{
id: e2hj4fz9g7p35hu,
dateTimeUTC: 2018-11-01T11:22:45Z,
ticketCurrency: USD,
ticketPrice: 0.1,
type: ADD_SERVICES,
details: {
unitCost: mo,
agentQuantity: 4,
agentCost: 2,
channelBasicQuantity: 2,
channelBasicCost: 50,
refMonth: 11
},
amount: -108
},
{
id: Dhr53dwr46gdwe36,
dateTimeUTC: 2018-12-05T19:35:62Z,
ticketCurrency: USD,
ticketPrice: 0.1,
type: ADD_CREDIT,
details: {
},
amount: 1000
},
...
]

Remove Services

Decrease the number of allowed agents/channels. To remove channels you must specify the Ids of the channels that you want remove. Be careful, your allowed agents must be greater than installed agents. Removing a service does not have an immediate effect on the your credit balance, however the following month you will pay only the current number of allowed agents/channels.

REQUEST
PUT /request=removeServices
{
agents: <num. agents to remove>,
channelsIDs: [<id 1>, <id 2>, <id 3>, ...]
}

RESPONSE
200 OK
{
agentsRemoved: 2,
channelsBasicRemoved: 3,
channelsRemoved: 3
}

Add Services

Increase your number of allowed agents/channels. For each added channel a new id will be generated. Be careful, this requires purchasing agents/channels using your credits. You can check the cost of the services by setting simultate=true in query string.

REQUEST
PUT /request=addServices[&simulate=true]
{
agents: <num. agents to add>,
channelsBasic: <num. channels to add>
}

RESPONSE
200 OK
{
agentsAdded: 3,
channelsBasicAdded: 2,
channelsBasicAddedIDs: [5,6],
channelsAdded: 2,
cost: {
transactionID: dFerx32dGTt8tg2sd,
ticketCurrency: USD,
ticketPrice: 0.1,
unitCost: mo,
agentQuantity: 3,
agentCost: 2,
channelBasicQuantity: 1,
channelBasicCost: 50,
refMonth: 11,
paidDays: 15,
total: 28
}
}

Get Account Info

REQUEST
GET /request=info

RESPONSE
200 OK
{
email: Your Email,
company: My Company,
firstName: First Name,
lastName: Last Name,
country: US,
address1: My street, 1,
address2: My street, 2,
postalcode: 123456,
city: My City,
stateprovince: My state,
telephone1: 123456,
fax: 123456,
vatid: 123456,
regnum: 123456,
localeID: en_US,
timeZone: America/Los_Angeles,
country: US,
credit: 1520,
agentsInstalled: 0,
agentsAllowed: 3,
channelsBasicAllowed: 4,
channelsAllowed: 4,
priceList: {
unit: mo,
ticketCurrency: USD,
ticketPrice: 0.1,
agentCost: 3,
channelBasicCost: 60
},
cost: {
unit: mo,
agents: 9,
channelsBasic: 240,
total: 249
},
channelsBasicIDs: [0,3,4,6]
}

Account resource

The url to perform operations on account resource is:

https://www.apiremoteaccess.com/en/api/json/account

This resource allows you to manage your account, add or remove services (agents/sessions allowed), get information regarding your credit and transactions. Credit and costs are expressed in “DWService API ticket” in the “priceList” block you can see the price for one ticket.

Response Structure

Each request produces an HTTPS response in JSON representations with the standard headers, response content, and status code.
The server returns status code 200 OK for successful requests, otherwise it returns the following status codes:

  • 400 Bad Request: Invalid query parameters, including unrecognised parameters, missing parameters, invalid values or server-side error.
  • 403 Forbidden: Invalid authentication
  • 404 Not Found: The provided URL does not match an existing resource. For example, an HTTP Method for the resource is unavailable.

In the case of an error, in addition to the status code, the response includes an error object containing more details about the error. The JSON response schema is as follows:

{
agents: <status code>,
channelsBasic: <error message>
}

Request Structure

The resource must be specified in the request URL: <base url>/<resource>. For example the url for agents resource is

https://www.apiremoteaccess.com/en/api/json/agents

Available request methods are:

  • GET: Retrieves data from the specified resource.
  • PUT: Adds the supplied information to the specified resource. Returns an error if the item is not found. In the request URL you must specify the id of the resource.
  • POST: Creates an item to the specified resource, with the supplied information.
  • DELETE: Deletes an item to the specified resource. In the request URL you must specify the id of resource.

Authentication

To work with the API you need to be authenticated by DWService. Register an DWService account at https://api.dwservice.net/signup.html, After that login with your account https://api.dwservice.net/login.html and go to My Account/Account, in “API Key” Section click “Generate New Key” button, set a key name and click “Create” button. Finally you get an API Key and Secret.

You can authenticate in two way:

1 – Basic HTTP authentication (Not Raccomended)
You have to add the “Authorization” header to the request.

Authorization: Basic base64(<key>:<secret>)

2 – HMAC Signature (Raccomended)
You have to add the “X-DW-Authorization” header to the request.

X-DW-Authorization: HM1 <key>:base64(hashHMAC(<curtime>,<secret>)):<curtime>

The HMAC hashing algorithm must be sha1, curtime is the current time expressed in milliseconds have passed since January 1, 1970, 00:00:00 GMT and it has an expire period of 10 minutes.

Introduction

The API enables you to integrate DWService in your applications. This document is a reference for developers on any platform, providing resources and methods to:

• Create, obtain, list, and modify agents.
• Create, list, and destroy sessions. A session represents a web connection to the agent (IFrame, Window, etc..), which can be configured to gain full or limited access.

The API gives you programmatic access to manage DWService through a Representational State Transfer (REST) API. The API allows external clients to perform CRUD (Create, Read, Update, Delete) operations on DWService resources. It is based on the HTTP protocol and REST methodology.
All API requests are sent over HTTPS in JSON representations to this base url:

https://www.apiremoteaccess.com/en/api/json/

This section provides an overview of how requests are structured, and the expected responses.

API