RE: Walmart Marketplace API
Greg Wilburn <gwilburn-kuYYJ3CQfvZxq3Q2jbZZw/[email protected]>
| Newsgroups | gmane.comp.lang.as400.rpg |
|---|---|
| Message-ID | <PH0PR17MB4863E5CFFF14FDB71CEF858ADA16A@PH0PR17MB4863.namprd17.prod.outlook.com> |
So I am still struggling here... I am able to connect to this API and receive an Access Token using Postman. However, I cannot seem to connect successfully from a simple RPG pgm using HTTPAPI (something I use all the time). I've even compared the HTTP request in Postman to the HTTPAPI debug file. I even compared the Base64 encoded "Authorization" in Notepad++. Differences: 1. Postman has a "cookie" 2. Headers are in a different order Any ideas? I'm at a complete loss. Postman HTTP (successful): POST /v3/token HTTP/1.1 Host: marketplace.walmartapis.com WM_SVC.NAME: Walmart Marketplace Accept: application/json User-Agent: http-api/1.43 Content-Type: application/x-www-form-urlencoded Authorization: Basic YTJlZTE..... Cookie: ak_bmsc=.......p4aGV/sU=~1 Content-Length: 29 grant_type=client_credentials HTTPAPI (unsuccessful): POST /v3/token HTTP/1.1 Host: marketplace.walmartapis.com User-Agent: http-api/1.43 Content-Type: application/x-www-form-urlencoded Content-Length: 29 Authorization: Basic YTJlZTE... WM_SVC.NAME: Walmart Marketplace Accept: application/json senddoc(): entered grant_type=client_credentials recvresp(): entered SetError() #44: CommTCP_read: Socket has been shut down. recvresp(): end with err http_close(): entered -----Original Message----- From: RPG400-L <[email protected]> On Behalf Of Greg Wilburn Sent: Tuesday, September 16, 2025 8:31 AM To: RPG programming on IBM i <[email protected]> Subject: RE: Walmart Marketplace API Sure... The clientId and clientSecret are set above this code. I am trying to get an Access Token. rc = http_setauth(HTTP_AUTH_BASIC :clientID :clientSecret); // Get an Access Token http_debug(*on :FLDR + '/' + inCom + '/http_debug.txt'); URL = 'https://marketplace.walmartapis.com/v3/token'; method = 'POST'; form = WebForm_open(); WebForm_setVar(form :'grant_type' :'client_credentials'); body = WebForm_getData(form); WebForm_close(form); Response = FLDR + '/' + inCom + '/token_response.json'; Exec Sql set :uuid = generate_uuid(); Ifs_WriteToFile(logFd:'UUID: ' + uuId); headerVars.partnerId = '10001667921'; headerVars.uniqueId = uuId; headerVars.serviceName = 'Walmart Marketplace'; headerVars.acceptType = 'application/json'; rc = http_xproc( HTTP_POINT_ADDL_HEADER : %paddr(addHttpHeaders) : %addr(headerVars)); rc = http_req( method : URL : response : *omit : *omit : body : 'application/x-www-form-urlencoded'); -----Original Message----- From: RPG400-L <[email protected]> On Behalf Of Jon Paris Sent: Monday, September 15, 2025 6:43 PM To: RPG programming on the IBM i (AS/400 and iSeries) <[email protected]> Subject: Re: Walmart Marketplace API Wanna share a code snippet so we can see what you are requesting. I played with this API a while back and had no issues. Nothing special that I can recall. Jon Paris [email protected] > On Sep 15, 2025, at 5:02 PM, Greg Wilburn <[email protected]> wrote: > > Just wondering if anyone has implemented this? > > Having issues just getting a token using HTTPAPI... the debug log shows an "unknown protocol" error. I'm not sure that I've noticed that before. > > Any insight would be appreciated. > > SetError() #49: SSL_protocol: Unknown protocol 5000 > Protocol Used: > http_persist_req(POST) entered. > http_long_ParseURL(): entered > http_long_ParseURL(): entered > do_oper(POST): entered > There are 0 cookies in the cache > POST /v3/token HTTP/1.1 > Host: marketplace.walmartapis.com > User-Agent: http-api/1.43 > Content-Type: application/x-www-form-urlencoded > Content-Length: 29 > Authorization: Basic - DELETED - > WM_PARTNER.ID: 10001667921 > WM_QOS.CORRELATION_ID: 82B37F6E-C4A5-4675-AA4B-AC14A2CD33B7 > WM_SVC.NAME: Walmart Marketplace > Accept: application/json > > senddoc(): entered > grant_type=client_credentials > recvresp(): entered > SetError() #44: CommTCP_read: Socket has been shut down. > recvresp(): end with err > http_close(): entered > [Logo]<https://www.totalbizfulfillment.com/> Greg Wilburn > Director of IT > 301.895.3792 ext. 1231 > 301.895.3895 direct > [email protected]<mailto:[email protected]> > 1 Corporate Dr > Grantsville, MD 21536 > www.totalbizfulfillment.com<http://www.totalbizfulfillment.com> > -- > This is the RPG programming on IBM i (RPG400-L) mailing list > To post a message email: [email protected] > To subscribe, unsubscribe, or change list options, > visit: https://lists.midrange.com/mailman/listinfo/rpg400-l > or email: [email protected] > Before posting, please take a moment to review the archives > at https://archive.midrange.com/rpg400-l. > > Please contact [email protected] for any subscription related questions. > -- This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: [email protected] To subscribe, unsubscribe, or change list options, visit: https://lists.midrange.com/mailman/listinfo/rpg400-l or email: [email protected] Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l. Please contact [email protected] for any subscription related questions. Greg Wilburn Director of IT 301.895.3792 ext. 1231 -- This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: [email protected] To subscribe, unsubscribe, or change list options, visit: https://lists.midrange.com/mailman/listinfo/rpg400-l or email: [email protected] Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l. Please contact [email protected] for any subscription related questions. Greg Wilburn Director of IT 301.895.3792 ext. 1231 -- This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: [email protected] To subscribe, unsubscribe, or change list options, visit: https://lists.midrange.com/mailman/listinfo/rpg400-l or email: [email protected] Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l. Please contact [email protected] for any subscription related questions.