# Request

To initiate a Sales Analysis & History request, send a GET request to the Easyparser Real-Time API endpoint.

### Endpoint

```
GET https://realtime.easyparser.com/v1/request
```

### Required Parameters

This operation requires certain common parameters to be included in every request. For more details, see [Common Required Request Fields](https://easyparser.gitbook.io/easyparser-documentation/real-time-integration/common-required-request-fields).

### Optional Parameters

| `history_range` | String | Defines the historical depth of the data in months. Valid values are `"0"`, `"3"`, `"6"`, `"9"`, `"12"`. |
| --------------- | ------ | -------------------------------------------------------------------------------------------------------- |

{% hint style="info" %}

> &#x20;**Important Note on Historical Data:** When you request historical data using `history_range` (e.g., `"3"` for 3 months), the API returns a `history` array.
>
> * Input: Defined in Months.
> * Output: Aggregated by Weeks.
>
> Each item in the `history` array represents one week of performance data (Views, Sales, Price, Rank) corresponding to the requested date range.
> {% endhint %}

#### Credit Consumption

This operation has a base cost of 5 credits. Requesting historical data incurs additional credits based on the depth of history required.

<table data-header-hidden><thead><tr><th width="175">history_range Value</th><th>Data Retrieved</th><th width="112.3333740234375">Base Cost</th><th>Additional Cost</th><th>Total Credits</th></tr></thead><tbody><tr><td><code>"0"</code> (Default)</td><td>Current Snapshot</td><td>5</td><td>+0</td><td>5 Credits</td></tr><tr><td><code>"3"</code></td><td>Last 3 Months</td><td>5</td><td>+3</td><td>8 Credits</td></tr><tr><td><code>"6"</code></td><td>Last 6 Months</td><td>5</td><td>+6</td><td>11 Credits</td></tr><tr><td><code>"9"</code></td><td>Last 9 Months</td><td>5</td><td>+9</td><td>14 Credits</td></tr><tr><td><code>"12"</code></td><td>Last 12 Months</td><td>5</td><td>+12</td><td>17 Credits</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr></tbody></table>

For more details, please refer to the [Credit Consumption Page](https://app.gitbook.com/o/Yxptz2v7vav2wV34N1oV/s/Ek7UiZVslGrV4U3FpDSV/amazon/credit-consumption).

### Example Request

{% tabs fullWidth="false" %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```javascript
curl --location 'https://realtime.easyparser.com/v1/request?
  api_key=YOUR_API_KEY&
  platform=AMZ&
  operation=SALES_ANALYSIS_HISTORY&
  domain=.com&
  asin=B07C2Z21X5&
  history_range=3'

```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code overflow="wrap" %}

```python

import requests
import json

# set up the request parameters
params = {
  "api_key": "YOUR_API_KEY",
  "platform": "AMZ",
  "operation": "SALES_ANALYSIS_HISTORY",
  "domain": ".com",
  "asin": "B07C2Z21X5",
  "history_range": "3",
}

# make the http GET request to Easyparser API
api_result = requests.get("https://realtime.easyparser.com/v1/request", params=params)

# print the JSON response from Easyparser API
print(json.dumps(api_result.json(), indent=2))
```

{% endcode %}
{% endtab %}

{% tab title="Node.js" %}
{% code overflow="wrap" %}

```javascript

const axios = require("axios");

// set up the request parameters
const params = {
  api_key: "YOUR_API_KEY",
  platform: "AMZ",
  operation: "SALES_ANALYSIS_HISTORY",
  domain: ".com",
  asin: "B07C2Z21X5",
  history_range: "3",
}

// make the http GET request to Easyparser API
axios.get("https://realtime.easyparser.com/v1/request", { params })
.then(response => {
  // print the JSON response from Easyparser API
  console.log(JSON.stringify(response.data, null, 2));
})
```

{% endcode %}
{% endtab %}

{% tab title="HTTP" %}
{% code overflow="wrap" %}

```http

GET /v1/request?
  api_key=YOUR_API_KEY&
  platform=AMZ&
  operation=SALES_ANALYSIS_HISTORY&
  domain=.com&
  asin=B07C2Z21X5&
  history_range=3 HTTP/1.1
Host: realtime.easyparser.com
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code overflow="wrap" %}

```php

<?php

# set up the request parameters
$params = [
  "api_key" => "YOUR_API_KEY",
  "platform" => "AMZ",
  "operation" => "SALES_ANALYSIS_HISTORY",
  "domain" => ".com",
  "asin" => "B07C2Z21X5",
  "history_range" => "3",
];

# make the http GET request to Easyparser API
$response = file_get_contents("https://realtime.easyparser.com/v1/request?" . http_build_query($params));

# print the JSON response from Easyparser API
echo $response;
```

{% endcode %}
{% endtab %}

{% tab title="GO" %}
{% code overflow="wrap" %}

```go

package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {
  // set up the request parameters
  url := "https://realtime.easyparser.com/v1/request?params := url.Values{}
params.Add("api_key", "YOUR_API_KEY")
params.Add("platform", "AMZ")
params.Add("operation", "SALES_ANALYSIS_HISTORY")
params.Add("domain", ".com")
params.Add("asin", "B07C2Z21X5")
params.Add("history_range", "3")
fullURL := fmt.Sprintf("%s?%s", baseURL, params.Encode())
"
  
  // make the http GET request to Easyparser API
  res, _ := http.Get(url)
  defer res.Body.Close()
  
  // print the JSON response from Easyparser API
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

{% endcode %}
{% endtab %}

{% tab title="C#" %}
{% code overflow="wrap" %}

```csharp

using System.Net.Http;

// set up the request parameters
var client = new HttpClient();

// make the http GET request to Easyparser API
var response = await client.GetAsync("https://realtime.easyparser.com/v1/request?var query = HttpUtility.ParseQueryString(string.Empty);
query["api_key"] = "YOUR_API_KEY";
query["platform"] = "AMZ";
query["operation"] = "SALES_ANALYSIS_HISTORY";
query["domain"] = ".com";
query["asin"] = "B07C2Z21X5";
query["history_range"] = "3";
var fullUrl = baseUrl + "?" + query.ToString();
");

// print the JSON response from Easyparser API
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code overflow="wrap" %}

```java

import okhttp3.*;

// set up the request parameters
OkHttpClient client = new OkHttpClient();

// make the http GET request to EasyParser API
Request request = new Request.Builder()
  .url("https://realtime.easyparser.com/v1/request?URIBuilder builder = new URIBuilder(baseUrl);
builder.addParameter("api_key", "YOUR_API_KEY");
builder.addParameter("platform", "AMZ");
builder.addParameter("operation", "SALES_ANALYSIS_HISTORY");
builder.addParameter("domain", ".com");
builder.addParameter("asin", "B07C2Z21X5");
builder.addParameter("history_range", "3");
String fullUrl = builder.build().toString();
")
  .build();

// print the JSON response from Easyparser API
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
```

{% endcode %}
{% endtab %}
{% endtabs %}
