Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Visual FoxPro) Amazon SP-API Get FeedsSee more Amazon SP-API ExamplesReturns feed details for the feeds that match the filters that you specify. For more information, see https://developer-docs.amazon.com/sp-api/docs/feeds-api-v2021-06-30-reference#get-feeds2021-06-30feeds
LOCAL loAuthAws LOCAL loRest LOCAL lnSuccess LOCAL loJsonToken LOCAL lcLwa_token LOCAL loSbResponse LOCAL lcPath LOCAL lnStatusCode LOCAL loJson LOCAL lcFeedId LOCAL lcFeedType LOCAL lcCreatedTime LOCAL lcProcessingStatus LOCAL lcProcessingStartTime LOCAL lcProcessingEndTime LOCAL lcNextToken LOCAL i LOCAL lnCount_i * This example requires the Chilkat API to have been previously unlocked. * See Global Unlock Sample for sample code. * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.AuthAws') loAuthAws = CreateObject('Chilkat.AuthAws') loAuthAws.AccessKey = "AWS_ACCESS_KEY" loAuthAws.SecretKey = "AWS_SECRET_KEY" loAuthAws.ServiceName = "execute-api" * Use the region that is correct for your needs. loAuthAws.Region = "eu-west-1" * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Rest') loRest = CreateObject('Chilkat.Rest') lnSuccess = loRest.Connect("sandbox.sellingpartnerapi-eu.amazon.com",443,1,1) IF (lnSuccess = 0) THEN ? loRest.LastErrorText RELEASE loAuthAws RELEASE loRest CANCEL ENDIF lnSuccess = loRest.SetAuthAws(loAuthAws) * Load the previously obtained LWA access token. * See Fetch SP-API LWA Access Token * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject') loJsonToken = CreateObject('Chilkat.JsonObject') lnSuccess = loJsonToken.LoadFile("qa_data/tokens/sp_api_lwa_token.json") IF (lnSuccess = 0) THEN ? "Failed to load LWA access token." RELEASE loAuthAws RELEASE loRest RELEASE loJsonToken CANCEL ENDIF * Add the x-amz-access-token request header. lcLwa_token = loJsonToken.StringOf("access_token") loRest.ClearAllHeaders() loRest.AddHeader("x-amz-access-token",lcLwa_token) loRest.ClearAllQueryParams() loRest.AddQueryParam("feedTypes","POST_PRODUCT_DATA") loRest.AddQueryParam("pageSize","10") loRest.AddQueryParam("processingStatuses","CANCELLED,DONE") * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder') loSbResponse = CreateObject('Chilkat.StringBuilder') lcPath = "/feeds/2021-06-30/feeds" lnSuccess = loRest.FullRequestNoBodySb("GET",lcPath,loSbResponse) IF (lnSuccess = 0) THEN ? loRest.LastErrorText RELEASE loAuthAws RELEASE loRest RELEASE loJsonToken RELEASE loSbResponse CANCEL ENDIF * Examine the response status. lnStatusCode = loRest.ResponseStatusCode IF (lnStatusCode <> 200) THEN ? "Response status text: " + loRest.ResponseStatusText ? "Response body: " ? loSbResponse.GetAsString() ? "Failed." RELEASE loAuthAws RELEASE loRest RELEASE loJsonToken RELEASE loSbResponse CANCEL ENDIF ? loSbResponse.GetAsString() * If successful, gets a JSON response such as the following: * { * "feeds": [ * { * "feedId": "FeedId1", * "feedType": "POST_PRODUCT_DATA", * "createdTime": "2019-12-11T13:16:24.630Z", * "processingStatus": "CANCELLED", * "processingStartTime": "2019-12-11T13:16:24.630Z", * "processingEndTime": "2019-12-11T13:16:24.630Z" * } * ], * "nextToken": "VGhpcyB0b2tlbiBpcyBvcGFxdWUgYW5kIGludGVudGlvbmFsbHkgb2JmdXNjYXRlZA==" * } * Use this online tool to generate parsing code from sample JSON: * Generate Parsing Code from JSON * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject') loJson = CreateObject('Chilkat.JsonObject') loJson.LoadSb(loSbResponse) lcNextToken = loJson.StringOf("nextToken") i = 0 lnCount_i = loJson.SizeOfArray("feeds") DO WHILE i < lnCount_i loJson.I = i lcFeedId = loJson.StringOf("feeds[i].feedId") lcFeedType = loJson.StringOf("feeds[i].feedType") lcCreatedTime = loJson.StringOf("feeds[i].createdTime") lcProcessingStatus = loJson.StringOf("feeds[i].processingStatus") lcProcessingStartTime = loJson.StringOf("feeds[i].processingStartTime") lcProcessingEndTime = loJson.StringOf("feeds[i].processingEndTime") i = i + 1 ENDDO ? "Success!" RELEASE loAuthAws RELEASE loRest RELEASE loJsonToken RELEASE loSbResponse RELEASE loJson |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.