Store Actions

Store Actions

The store actions API allows you to peform specific actions. The API allows for the actions to be completed
on a store product or alternatively a product and label combination (link). Each ESL installation can have custom actions
defined for each store so the action type can be restricted per client and store.

  • Method: POST
  • URL: https://madic-esl.markethubpulse.com/api/StoreAction/OnProduct/

The method takes a JSON or XMl object via the post method. The product id and the store id
needs to be passed in the object along with the action type and the value associated with the action. The URL which the
psot needs to be directed to is as follows: https://madic-esl.markethubpulse.com/api/StoreAction/OnProduct

Request Headers

Header Field Name Value
Accept application/json or application/xml
Authorisation Basic authentication with base 64 encoded credentials e.g. "Basic dGVzdHVzZXI6dGVzdHBhc3N3b3Jk". See EndPoint & Authorisation for more information.

Body Format

Name Type Description
Store ID String The unique store id
ProductID String The unique product id for the product within the system.
ActionType String A code indicating the action to perform
ActionValue String A supplementary value to the action. Used for example in state changes such as an out of stock status or a replenishment request.

Once the request is successful the response will an object with the following values : to indicate if it was successful:

Response Format

Name Type Description
Error bit A bit/boolean flag indicating that an error occurred. 0 = Successful 1 = Error
ErrorMessage String If the action failed then this field will indicate what failed during the process.

Example Response

HTTP/1.1 200 OK
Content-Type: application/json

{
"Error": 1,
"ErrorMessage": "The store id of 'TestStore' does not exist"
}

Sample Code


// Sample Class Definition
public class StoreAction
{
public string StoreID;
public string ProductID;
public string ActionType;
public string ActionValue;
}

// Sample Code for Product post
StoreAction myAction = new StoreAction
{
ProductID ="Prod12345",
StoreID="DemoStore",
ActionType="REPLEN",
ActionValue="32"
};

HttpClient client = new HttpClient();
client.BaseAddress = new Uri("https://madic-esl.markethubpulse.com/api/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = client.PostAsJsonAsync("StoreAction/OnProduct", myAction).Result;

if (response.IsSuccessStatusCode)
{
string data = await response.Content.ReadAsStringAsync();
// Do something with the reurn data. Check the Error flag.
}
else
{
// Handle the post failure.
}

  • Method: POST
  • URL: https://madic-esl.markethubpulse.com/api/StoreAction/OnLink/

The method takes a JSON or XMl object via the post method. The product ID,store ID & label ID
needs to be passed in the object along with the action type and the value associated with the action. The URL which the
psot needs to be directed to is as follows: https://madic-esl.markethubpulse.com/api/StoreAction/OnProduct

Request Headers

Header Field Name Value
Accept application/json or application/xml
Authorisation Basic authentication with base 64 encoded credentials e.g. "Basic dGVzdHVzZXI6dGVzdHBhc3N3b3Jk". See EndPoint & Authorisation for more information.

Body Format

Name Type Description
Store ID String The unique store id
LabelID String The unique label id for the Store ESL installation.
ProductID String The unique product id for the product within the system.
ActionType String A code indicating the action to perform
ActionValue String A supplementary value to the action. Used for example in state changes such as an out of stock status or a replenishment request.

Once the request is successful the response will an object with the following values : to indicate if it was successful:

Response Format

Name Type Description
Error bit A bit/boolean flag indicating that an error occurred. 0 = Successful 1 = Error
ErrorMessage String If the action failed then this field will indicate what failed during the process.

Example Response

HTTP/1.1 200 OK
Content-Type: application/json

{
"Error": 1,
"ErrorMessage": "The store id of 'TestStore' does not exist"
}

Sample Code


// Sample Class Definition
public class StoreAction
{
public string StoreID;
public string ProductID;
public string LabelID;
public string ActionType;
public string ActionValue;
}

// Sample Code for Product post
StoreAction myAction = new StoreAction
{
ProductID ="Prod12345",
StoreID="DemoStore",
StoreID="B500AD99",
ActionType="RotateStock",
ActionValue="Y"
};

HttpClient client = new HttpClient();
client.BaseAddress = new Uri("https://madic-esl.markethubpulse.com/api/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = client.PostAsJsonAsync("StoreAction/OnLink", myAction).Result;

if (response.IsSuccessStatusCode)
{
string data = await response.Content.ReadAsStringAsync();
// Do something with the reurn data. Check the Error flag.
}
else
{
// Handle the post failure.
}

  • Method: Get
  • URL: https://madic-esl.markethubpulse.com/api/StoreAction/GetProductActionStates/

The method takes 2 parameters via the url. States are filtered at the store & product level so the
store id and product id needs to be passed inthe url. So for example if the store is 'SampleStore'
and the product id is '12345' then the url for the request would be as follows: https://madic-esl.markethubpulse.com/api/StoreAction/GetProductActionStates?storeid=SampleStore&productid=12345

Request Headers

Header Field Name Value
Accept application/json or application/xml
Authorisation Basic authentication with base 64 encoded credentials e.g. "Basic dGVzdHVzZXI6dGVzdHBhc3N3b3Jk". See EndPoint & Authorisation for more information.

Once the request is successful the response will an object with the following values : to indicate if it was successful:

Response Format

Name Type Description
ActionType String The unqiue code for the action type
ActionValue String The value associated with the previous action.

Example Response

HTTP/1.1 200 OK
Content-Type: application/json

[
{
"ActionType": "OOS",
"ActionValue": "Y"
}, "ActionType": "RESTOCKQTY",
"ActionValue": "42"
},
]

Sample Code

HttpClient client = new HttpClient();
client.BaseAddress = new Uri("https://madic-esl.markethubpulse.com/api/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
string storeid = "SampleStore";
string productid = "12345";
string url = "StoreAction/GetProductActionStates?storeid=" + storeid + "&productid=" + productid;
HttpResponseMessage response = await client.GetAsync(url);
if (response.IsSuccessStatusCode)
{
string data = await response.Content.ReadAsStringAsync();
// Do something with the json data
}
else
{
// Handle the failure in here
}

  • Method: Get
  • URL: https://madic-esl.markethubpulse.com/api/StoreAction/GetLinkActionStates/

The method takes 3 parameters via the url. States are filtered at the store, product & label level so the
store id, product id & label if needs to be passed inthe url. So for example if the store is 'SampleStore',
the product id is '12345' and the label id is 'B500AD99' then the url for the request would be as follows:
https://madic-esl.markethubpulse.com/api/StoreAction/GetLinkActionStates?storeid=SampleStore&productid=12345&labelid=B500AD99

Request Headers

Header Field Name Value
Accept application/json or application/xml
Authorisation Basic authentication with base 64 encoded credentials e.g. "Basic dGVzdHVzZXI6dGVzdHBhc3N3b3Jk". See EndPoint & Authorisation for more information.

Once the request is successful the response will an object with the following values : to indicate if it was successful:

Response Format

Name Type Description
ActionType String The unqiue code for the action type
ActionValue String The value associated with the previous action.

Example Response

HTTP/1.1 200 OK
Content-Type: application/json

[
{
"ActionType": "OOS",
"ActionValue": "Y"
}, "ActionType": "RESTOCKQTY",
"ActionValue": "42"
},
]

Sample Code

HttpClient client = new HttpClient();
client.BaseAddress = new Uri("https://madic-esl.markethubpulse.com/api/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
string storeid = "SampleStore";
string productid = "12345";
string labelid = "B500AD99";
string url = "StoreAction/GetProductActionStates?storeid=" + storeid + "&productid=" + productid
+ "&labelid" = + labelid;
HttpResponseMessage response = await client.GetAsync(url);
if (response.IsSuccessStatusCode)
{
string data = await response.Content.ReadAsStringAsync();
// Do something with the json data
}
else
{
// Handle the failure in here
}

;