Projects¶
Get a list of projects available to the user¶
GET /user/projects
With this method you can get a list of projects available to the user.
By the parameter is_owner
you can distinguish which projects the user is the owner of.
curl 'https://cloud.roistat.com/api/v1/user/projects' \
--request GET \
--header 'Content-type: application/json' \
--header 'Api-key: {KEY}'
{
"projects": [
{
"id": 111,
"name": "project1",
"profit": "0",
"creation_date": "2016-09-01 07:55:11",
"currency": "USD",
"is_owner": 1
},
{
"id": 222,
"name": "project2",
"profit": null,
"creation_date": "2017-08-08 14:47:29",
"currency": "USD",
"is_owner": 1
}
],
"status": "success"
}
No parameters.
Parameter | Type | Description |
---|---|---|
projects | array[object] | |
> id | integer | Project ID |
> name | string | Project name |
> profit | null or string | Profit share in project revenue. Can be changed in project settings |
> creation_date | string | Project creation date |
> currency | string | Project currency |
> is_owner | integer | Is the user the owner of the project. 1 - yes, 0 - no. |
status | string |
Create a new project¶
POST /account/project/create
With this method you can create a new project.
curl 'https://cloud.roistat.com/api/v1/account/project/create' \
--request POST \
--header 'Content-type: application/json' \
--header 'Api-key: {KEY}' \
--data Request body - see below
Request Body:
{
"name": "Test",
"currency": "USD"
}
{
"data": {
"project_id": 123,
"counter": {
"id": "qwerty123456",
"code": "<script>(function(w, d, s, h, id){w.roistatProjectId = id; w.roistatHost = h;})(window, document, 'script', 'cloud.roistat.com', 'qwerty123456');</scipt>"
}
}
}
Query String:
No parameters.
Request Body:
Parameter | Type | Description | Required |
---|---|---|---|
name | string | Project name | yes |
currency | string | Project currency: RUB - Russian ruble, USD - US dollar, EUR - euro, UAH - Ukrainian hryvnia, KZT - Kazakhstan tenge, BYN - Belarusian ruble, BYR - Belarusian ruble (outdated), CHF - Swiss franc, GBP - British pound, CZK - Czech koruna, AED - UAE dirham. The currency name must be indicated only in the form of a currency code. | yes |
Parameter | Type | Description |
---|---|---|
data | object | |
> project_id | number | The ID of the project that was created |
> counter | object | Tracking code details for the project |
>> id | string | The ID of the tracking code |
>> code | string | JavaScript code of the tracking code |
Get the tracking code for the project¶
POST /project/settings/counter/list
With this method you can get the tracking code for the project.
You can use either the POST
or theGET
method.
curl 'https://cloud.roistat.com/api/v1/project/settings/counter/list?project=12345' \
--request POST \
--header 'Content-type: application/json' \
--header 'Api-key: {KEY}'
{
"data": [
{
"id": "qwerty123456",
"code": "<script>(function(w, d, s, h, id){w.roistatProjectId = id; w.roistatHost = h;})(window, document, 'script', 'cloud.roistat.com', 'qwerty123456');</scipt>"
}
]
}
Query String:
Parameter | Type | Description | Required |
---|---|---|---|
project | string | Project number | yes |
Request Body:
No parameters.
Parameter | Type | Description |
---|---|---|
data | array[object] | |
> id | string | ID of the tracking code |
> code | string | JS code of the tracking code |