Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

120
Visualizações
Making a POST request with Nodejs to Walmart Catalog Services

I'm having some trouble making a POST request with Nodejs. I can make the request with curl, but when I try and to do the same thing in Nodejs, I just get junk data back. I'm calling a Walmart service.

This is what my curl request looks like. This works fine.

curl -d "grant_type=client_credentials&client_id= WALMART_CLIENT_ID&client_secret= WALMART_CLIENT_SECRET" -X POST https://developer.api.walmart.com/api-proxy/service/identity/oauth/v1/token

This is an example of my code in Nodejs. I'm just getting junk data back from Walmart.

const https = require('https');
const qs = require('querystring');

const data = {
    grant_type: "client_credentials",
    client_id: WALMART_CLIENT_ID,
    client_secret: WALMART_CLIENT_SECRET,
};

const options = {
    hostname: "developer.api.walmart.com", 
    path: "/api-proxy/service/identity/oauth/v1/token", 
    method: "POST"
};

const request = https.request(options, result => {

    var chunks = [];
    result.on('data', data => {
        chunks.push(data);
    });

    result.on('end', () => {
        var body = chunks.join("");
        console.log(body);
    });
    
    request.on('error', error => {
        reject(error);
    });        
});

request.write(qs.stringify(data));
request.end();  

The code works fine if I do a test POST request here. I'm not sure what I'm missing, or what curl is doing to have the Walmart request work.

const options = {
    hostname: "reqbin.com",
    path: "/echo/post/json",
    method: "POST"
};

const data = {};
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Except Catalog Pricing And Availability Snapshot and Catalog Store Locator API, all other APIs are GET calls not POST Please verify which catalog API you are consuming and which HTTP method you are using

Request to follow below 2 steps to consumer any catalog API

  1. First step, client would use api proxy service OAuth API to get the auth token using wm_consumer.id, client_id, client_secret.
  2. Second step would be to call price and availability deltas API with relevant wm_consumer.id and auth token, i.e using the API token received from OAuth API, a call is made to the price and availability deltas API along with relevant wm_consumer.id Please find the attachements for reference

Regards, Firdos IOSupport

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda