Loading ...

How To Get Response From Walmart

Hello everybody,

today I want to share with the world another piece of code, producing of which took me significant amount of efforts, getting response from Walmart.

Yesterday I've posted code that signs provided by Walmart credentials.

And today I decided to post code that retrieves orders information from Walmart.

private void MakeRequests()
{
    HttpWebResponse response;

    if (Request_marketplace_walmartapis_com(out response))
    {
        response.Close();
    }
}

private bool Request_marketplace_walmartapis_com(out HttpWebResponse response)
{
    response = null;

    try
    {
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://marketplace.walmartapis.com/v3/orders?createdStartDate=2016-08-16");

        request.Headers.Add("WM_SVC.NAME", "Walmart Marketplace");
        request.Headers.Add("WM_QOS.CORRELATION_ID", "123456abcdef");
        request.Headers.Add("WM_SEC.AUTH_SIGNATURE", "trimmed for security reasons");
        request.Headers.Add("WM_SEC.TIMESTAMP", "1495703564642");
        request.Headers.Add("WM_CONSUMER.ID", @"guid of customer that was provided to you by Walmart");
        request.Headers.Add("WM_CONSUMER.CHANNEL.TYPE", @"0f3e4dd4-0514-4346-b39d-af0e00ea066d");

        response = (HttpWebResponse)request.GetResponse();
    }
    catch (WebException e)
    {
        if (e.Status == WebExceptionStatus.ProtocolError) response = (HttpWebResponse)e.Response;
        else return false;
    }
    catch (Exception)
    {
        if(response != null) response.Close();
        return false;
    }

    return true;
}

In case if you'll have a need to make Walmart request, enjoy.

2 Comments

  • Saurabh said 19 months ago

    Hi -

    I have tried with your code (also taken the code for creating Signature) but I am getting an error "The remote server returned an error: (401) Unauthorized."

    Can you please help with this issue?

    BaseUrl = https://marketplace.walmartapis.com/v3/orders?createdStartDate=2017-10-30

  • docotor said 19 months ago

    Do you have gitlab account? I can give you new version of Walmart reader.

Be the first to rate this post

  • Currently 0.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5