Skip to content

API Usage Analyzer

Overview

The API Usage Analyze API allows you to fetch the number of operations made in last hour, so as to keep track of rate limit on API operations per hour.

Usage: To fetch the number of operations made in the last hour and keep track of the rate limit on API operations per hour.

Details about ‘Request Header' and 'Authorization’ are available in the Authorization Guide

Get Last Hour API Usage

Description: Get a count of how many total API operations were recorded in the last hour from the current timestamp, by user.

End Point: /api/v1/api_usage_analyze

HTTP Method: GET

Sample Request

1
2
3
4
5
6
7
8
curl --location 
'https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/api_usage_analyze'
--header 'Authorization: Bearer **************'  
--header 'wm_consumer.id: ***************' 
--header 'wm_sec.key_version: 2' 
--header 'wm_sec.auth_signature: ****************' 
--header 'wm_qos.correlation_id: 12345' 
--header 'wm_consumer.intimestamp: 1707205605000' 
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/api_usage_analyze") 
.method("GET", body)
.addHeader("Authorization", "Bearer ***********") 
.addHeader("wm_consumer.id", "*******************")
.addHeader("wm_sec.key_version", "2")
.addHeader("wm_sec.auth_signature", "*******************")
.addHeader("wm_qos.correlation_id", "12345")
.addHeader("wm_consumer.intimestamp", "1707205605000") 
Response response = client.newCall(request).execute();
const axios = require('axios'); 
let config = { 
method: 'get', 
maxBodyLength: Infinity, 

url: 'https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/api_usage_analyze', 

headers: {  
    'wm_consumer.id': '**************',  
    'wm_sec.key_version': '2',  
    'wm_sec.auth_signature': '******************',  
    'wm_qos.correlation_id': '12345',  
    'wm_consumer.intimestamp': '******************',  
    'Authorization': 'Bearer ***************' 
} 
}; 
axios.request(config) 
.then((response) => { 
console.log(JSON.stringify(response.data)); 
}) 
.catch((error) => { 
console.log(error); 

}); 
import requests

url = "https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/api_usage_analyze" 

payload = {}
headers = {
'Authorization': 'Bearer ***************', 
'wm_consumer.id': '************',
'wm_sec.key_version': '2',
'wm_sec.auth_signature': '*************',
'wm_qos.correlation_id': '12345',
'wm_consumer.intimestamp': '1707205605000'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)

Response

Element Description Type
count Total number of API operations made in last hour Total number of API operations made in last hour

Sample Response

[
  {
    "count": 500
  }
]

HTTP Status Code

Status Code Description Possible Error Messages
403 Forbidden User not Authenticated
429 Too Many Requests <Exception Message>
500 Internal server error There was an error processing the request