Edit campaign
Edit
- http
- shell
- python
- php
- C#
PUT /me/campaigns/:campaignId HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
Content-Type: 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
X-Aplazame-Media-Type: aplazame.v1
Partial edition
- http
- shell
- python
- php
- C#
PATCH /me/campaigns/:campaignId HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
Content-Type: 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 | 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 204 NO CONTENT
X-Aplazame-Media-Type: aplazame.v1