Campaigns API
The API Campaigns allow you to manage the financing campaigns of your store.
Consult the documentation on the financing campaigns as a strategy to increase sales in your store.
Create
The type of campaign is determined by the partial
parameter, it could be a full campaign that applies to all items in your store, or it could be a partial campaign that applies to specific items.
In the case of a partial campaign it is necessary to add the articles to which the financing campaign applies.
Learn how to manage the articles of a financing campaign.
POST /me/campaigns HTTP/1.1
application/vnd.aplazame.v1+json
Bearer api_private_key
api.aplazame.com
application/json
{
"name": "Summertime",
"start_date": "2016-06-01T00:00:00",
"end_date": "2016-08-31T23:59:59",
"interest": "2500",
"partial": true,
"num_instalments": [1, 2, 3, 5, 8]
}
$ curl "https://api.aplazame.com/me/campaigns" \
-H "Accept: application/vnd.aplazame.v1+json" \
-H "Authorization: Bearer api_private_key"\
--data-binary '{
"name": "Summertime",
"start_date": "2016-06-01T00:00:00",
"end_date": "2016-08-31T23:59:59",
"interest": "2500",
"partial": true,
"num_instalments": [1, 2, 3, 5, 8]
}'
import aplazame_sdk
client = aplazame_sdk.Client('api_private_key')
response = client.post_campaign(':merchantId', {
'name': 'Summertime',
'start_date': '2016-06-01T00:00:00',
'end_date': '2016-08-31T23:59:59',
'interest': '2500',
'partial': True,
'num_instalments': [1, 2, 3, 5, 8]
})
use Aplazame\Api\Client as AplazameClient;
$aplazameClient = new AplazameClient("https://api.aplazame.com", AplazameClient::ENVIRONMENT_PRODUCTION, "api_private_key");
$campaign = [
"name" => "Summertime",
"start_date" => Aplazame\Serializer\Decimal::fromDateTime(new DateTime("2016-06-01 00:00:00")),
"end_date" => Aplazame\Serializer\Decimal::fromDateTime(new DateTime("2016-08-31 23:59:59")),
"interest" => Aplazame\Serializer\Decimal::fromFloat(25),
"partial" => true,
"num_instalments" => [1, 2, 3, 5, 8],
];
$result = $aplazameClient->post("/me/campaigns", $campaign);
using Aplazame.Api;
Client client = new Client("https://api.aplazame.com", Client.EnvironmentProduction, "api_private_key");
dynamic campaign = new {
name = "Summertime",
start_date = Aplazame.Serializer.DateType.FromDateTime(DateTime.Parse("2016-06-01 00:00:00")),
end_date = Aplazame.Serializer.DateType.FromDateTime(DateTime.Parse("2016-08-31 23:59:59")),
interest = Aplazame.Serializer.DecimalType.FromDouble(25),
partial = true,
num_instalments = [1, 2, 3, 5, 8],
};
dynamic result = client.Post($"/me/campaigns", campaign);
Response
HTTP/1.1 201 CREATED
application/json
aplazame.v1
{
"id": "c994e03e42d24be7bf6e1fcbad3334c0",
"name": "Summertime",
"start_date": "2016-06-01T00:00:00",
"end_date": "2016-08-31T23:59:59",
"interest": 2500,
"partial": true,
"num_instalments": [1, 2, 3, 5, 8],
"created": "2016-03-10T11:08:57.265971"
}
Details
GET /me/campaigns/:campaignId HTTP/1.1
application/vnd.aplazame.v1+json
Bearer api_private_key
api.aplazame.com
$ curl "https://api.aplazame.com/me/campaigns/:campaignId" \
-H "Accept: application/vnd.aplazame.v1+json" \
-H "Authorization: Bearer api_private_key"
import aplazame_sdk
client = aplazame_sdk.Client('api_private_key')
response = client.get_campaign(':merchantId', ':campaignId')
use Aplazame\Api\Client as AplazameClient;
$aplazameClient = new AplazameClient("https://api.aplazame.com", AplazameClient::ENVIRONMENT_PRODUCTION, "api_private_key");
$result = $aplazameClient->get("/me/campaigns/{$campaignId}");
using Aplazame.Api;
Client client = new Client("https://api.aplazame.com", Client.EnvironmentProduction, "api_private_key");
dynamic result = client.Get($"/me/campaigns/{campaignId}");
Parameter |
Type |
Required |
Description |
:merchantId |
hash |
yes |
id of the store to perform action with |
:campaignId |
hash |
yes |
id of the campaign to perform action with |
Response
HTTP/1.1 200 OK
application/json
aplazame.v1
{
"id": "c994e03e42d24be7bf6e1fcbad3334c0",
"name": "Summertime",
"start_date": "2016-06-01T00:00:00",
"end_date": "2016-08-31T23:59:59",
"interest": 2500,
"partial": true,
"num_instalments": [1, 2, 3, 5, 8],
"created": "2016-03-10T11:08:57.265971"
}
Parameter |
Type |
Description |
id |
hash |
Hostname id , |
name |
string |
Campaign name |
start_date |
ISO 8601 |
Start date of the campaign |
end_date |
ISO 8601 |
End date of the campaign |
interest |
decimal |
Interest discount rate |
partial |
Boolean |
Determines if the campaign applies to all products |
Edit
PUT /me/campaigns/:campaignId HTTP/1.1
application/vnd.aplazame.v1+json
Bearer api_private_key
api.aplazame.com
application/json
{
"name": "Summertime",
"start_date": "2016-06-01T00:00:00",
"end_date": "2016-08-31T23:59:59",
"interest": "2500",
"partial": true,
"num_instalments": [1, 2, 3, 5, 8]
}
$ curl "https://api.aplazame.com/me/campaigns/:campaignId" \
-H "Accept: application/vnd.aplazame.v1+json" \
-H "Authorization: Bearer api_private_key"\
-X PUT\
--data-binary '{
"name": "Summertime",
"start_date": "2016-06-01T00:00:00",
"end_date": "2016-08-31T23:59:59",
"interest": "2500",
"partial": true,
"num_instalments": [1, 2, 3, 5, 8]
}'
import aplazame_sdk
client = aplazame_sdk.Client('api_private_key')
response = client.put_campaign(':merchantId', ':campaignId', {
'name': 'Summertime',
'start_date': '2016-06-01T00:00:00',
'end_date': '2016-08-31T23:59:59',
'interest': '2500',
'partial': True,
'num_instalments': [1, 2, 3, 5, 8]
})
use Aplazame\Api\Client as AplazameClient;
$aplazameClient = new AplazameClient("https://api.aplazame.com", AplazameClient::ENVIRONMENT_PRODUCTION, "api_private_key");
$campaign = [
"name" => "Summertime",
"start_date" => Aplazame\Serializer\Decimal::fromDateTime(new DateTime("2016-06-01 00:00:00")),
"end_date" => Aplazame\Serializer\Decimal::fromDateTime(new DateTime("2016-08-31 23:59:59")),
"interest" => Aplazame\Serializer\Decimal::fromFloat(25),
"partial" => true,
"num_instalments" => [1, 2, 3, 5, 8],
];
$result = $aplazameClient->put("/me/campaigns/{campaignId}", $campaign);
using Aplazame.Api;
Client client = new Client("https://api.aplazame.com", Client.EnvironmentProduction, "api_private_key");
dynamic campaign = new {
name = "Summertime",
start_date = Aplazame.Serializer.DateType.FromDateTime(DateTime.Parse("2016-06-01 00:00:00")),
end_date = Aplazame.Serializer.DateType.FromDateTime(DateTime.Parse("2016-08-31 23:59:59")),
interest = Aplazame.Serializer.DecimalType.FromDouble(25),
partial = true,
num_instalments = [1, 2, 3, 5, 8],
};
dynamic result = client.Put($"/me/campaigns/{campaignId}", campaign);
Parameter |
Type |
Required |
Description |
name |
string |
yes |
Campaign name |
start_date |
ISO 8601 |
yes |
Start date of the campaign |
end_date |
ISO 8601 |
no |
End date of the campaign |
interest |
decimal |
yes |
Interest discount rate |
partial |
Boolean |
no |
Determines if the campaign applies to all products, false by default |
num_instalments |
array |
no |
Number of instalments available for the campaign |
Response
HTTP/1.1 204 NO CONTENT
aplazame.v1
Partial edit
PATCH /me/campaigns/:campaignId HTTP/1.1
application/vnd.aplazame.v1+json
Bearer api_private_key
api.aplazame.com
application/json
{
"start_date": "2016-06-22T00:00:00"
}
$ curl "https://api.aplazame.com/me/campaigns/:campaignId" \
-H "Accept: application/vnd.aplazame.v1+json" \
-H "Authorization: Bearer api_private_key"\
-X PATCH\
--data-binary '{
"start_date": "2016-06-22T00:00:00"
}'
import aplazame_sdk
client = aplazame_sdk.Client('api_private_key')
response = client.patch_campaign(':merchantId', ':campaignId', {
'start_date': '2016-06-22'
})
use Aplazame\Api\Client as AplazameClient;
$aplazameClient = new AplazameClient("https://api.aplazame.com", AplazameClient::ENVIRONMENT_PRODUCTION, "api_private_key");
$campaign = [
"start_date" => Aplazame\Serializer\Decimal::fromDateTime(new DateTime("2016-06-22 00:00:00")),
];
$result = $aplazameClient->patch("/me/campaigns/{campaignId}", $campaign);
using Aplazame.Api;
Client client = new Client("https://api.aplazame.com", Client.EnvironmentProduction, "api_private_key");
dynamic campaign = new {
start_date = Aplazame.Serializer.DateType.FromDateTime(DateTime.Parse("2016-06-22 00:00:00")),
};
dynamic result = client.Patch($"/me/campaigns/{campaignId}", campaign);
Parameter |
Type |
Required |
Description |
:merchantId |
hash |
yes |
id of the store to perform action with |
:campaignId |
hash |
yes |
id of the campaign to perform action with |
HTTP/1.1 204 NO CONTENT
aplazame.v1
Parameter |
Type |
Required |
Description |
--------- |
---- |
-------- |
----------- |
name |
string |
no |
Campaign name |
start_date |
ISO 8601 |
no |
Start date of the campaign |
end_date |
ISO 8601 |
no |
End date of the campaign |
interest |
decimal |
no |
Interest discount rate |
partial |
Boolean |
no |
Determines if the campaign applies to all products, false by default |
num_instalments |
array |
no |
Number of instalments available for the campaign |
Delete
DELETE /me/campaigns/:campaignId HTTP/1.1
application/vnd.aplazame.v1+json
Bearer api_private_key
api.aplazame.com
$ curl "https://api.aplazame.com/me/campaigns/:campaignId " \
-H "Accept: application/vnd.aplazame.v1+json" \
-H "Authorization: Bearer api_private_key"\
-X DELETE
import aplazame_sdk
client = aplazame_sdk.Client('api_private_key')
response = client.delete_campaign(':merchantId', ':campaignId')
use Aplazame\Api\Client as AplazameClient;
$aplazameClient = new AplazameClient("https://api.aplazame.com", AplazameClient::ENVIRONMENT_PRODUCTION, "api_private_key");
$result = $aplazameClient->delete("/me/campaigns/{$campaignId}");
using Aplazame.Api;
Client client = new Client("https://api.aplazame.com", Client.EnvironmentProduction, "api_private_key");
dynamic result = client.Delete($"/me/campaigns/{campaignId}");
Response
HTTP/1.1 204 NO CONTENT
aplazame.v1
List
GET /me/campaigns?page=2 HTTP/1.1
application/vnd.aplazame.v1+json
Bearer api_private_key
api.aplazame.com
$ curl "https://api.aplazame.com/me/campaigns" \
-H "Accept: application/vnd.aplazame.v1+json" \
-H "Authorization: Bearer api_private_key"
import aplazame_sdk
client = aplazame_sdk.Client('api_private_key')
response = client.merchant_request('campaigns', ':merchantId')
response = client.campaigns()
use Aplazame\Api\Client as AplazameClient;
$aplazameClient = new AplazameClient(
"https://api.aplazame.com",
AplazameClient::ENVIRONMENT_PRODUCTION,
"api_private_key"
);
$result = $aplazameClient->get("/me/campaigns");
using Aplazame.Api;
Client client = new Client(
"https://api.aplazame.com",
Client.EnvironmentProduction,
"api_private_key"
);
dynamic result = client.Get($"/me/campaigns");
Response
HTTP/1.1 200 OK
application/json
aplazame.v1
{
"cursor": {
"after": 3,
"before": 1
},
"paging": {
"count": 314,
"next": "https://api.aplazame.com/me/campaigns?page=3",
"previous": "https://api.aplazame.com/me/campaigns?page=1"
},
"results": [
]
}
Parameter |
Type |
Description |
cursor |
object |
Pagination cursor object |
paging |
object |
Pagination status |
results |
collection |
List of campaigns |