Analytics
Create analytics report
Developer API operation for POST /dev/v1/analytics/reports.
POST
/
dev
/
v1
/
analytics
/
reports
Create analytics report
curl --request POST \
--url https://api.shoppex.io/dev/v1/analytics/reports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Revenue weekly",
"type": "revenue",
"frequency": "weekly",
"email": "[email protected]",
"format": "pdf"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Revenue weekly',
type: 'revenue',
frequency: 'weekly',
email: '[email protected]',
format: 'pdf'
})
};
fetch('https://api.shoppex.io/dev/v1/analytics/reports', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.shoppex.io/dev/v1/analytics/reports"
payload = {
"name": "Revenue weekly",
"type": "revenue",
"frequency": "weekly",
"email": "[email protected]",
"format": "pdf"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.shoppex.io/dev/v1/analytics/reports",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Revenue weekly',
'type' => 'revenue',
'frequency' => 'weekly',
'email' => '[email protected]',
'format' => 'pdf'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.shoppex.io/dev/v1/analytics/reports"
payload := strings.NewReader("{\n \"name\": \"Revenue weekly\",\n \"type\": \"revenue\",\n \"frequency\": \"weekly\",\n \"email\": \"[email protected]\",\n \"format\": \"pdf\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"data": {}
}{
"data": {
"report": {
"uniqid": "report_1",
"name": "Revenue weekly",
"type": "revenue",
"frequency": "weekly",
"format": "pdf",
"email": "[email protected]",
"downloadUrl": null
}
}
}Authorizations
Use your Shoppex API key in the Authorization header.
Body
application/jsonmultipart/form-datatext/plain
type
Option 1 · enum<string>Option 2 · enum<string>Option 3 · enum<string>Option 4 · enum<string>
required
Available options:
revenue frequency
Option 1 · enum<string>Option 2 · enum<string>Option 3 · enum<string>Option 4 · enum<string>
required
Available options:
daily Available options:
pdf Response
Successful response
Previous
Generate analytics reportDeveloper API operation for POST /dev/v1/analytics/reports/{id}/generate.
Next
⌘I
Create analytics report
curl --request POST \
--url https://api.shoppex.io/dev/v1/analytics/reports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Revenue weekly",
"type": "revenue",
"frequency": "weekly",
"email": "[email protected]",
"format": "pdf"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Revenue weekly',
type: 'revenue',
frequency: 'weekly',
email: '[email protected]',
format: 'pdf'
})
};
fetch('https://api.shoppex.io/dev/v1/analytics/reports', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.shoppex.io/dev/v1/analytics/reports"
payload = {
"name": "Revenue weekly",
"type": "revenue",
"frequency": "weekly",
"email": "[email protected]",
"format": "pdf"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.shoppex.io/dev/v1/analytics/reports",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Revenue weekly',
'type' => 'revenue',
'frequency' => 'weekly',
'email' => '[email protected]',
'format' => 'pdf'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.shoppex.io/dev/v1/analytics/reports"
payload := strings.NewReader("{\n \"name\": \"Revenue weekly\",\n \"type\": \"revenue\",\n \"frequency\": \"weekly\",\n \"email\": \"[email protected]\",\n \"format\": \"pdf\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"data": {}
}{
"data": {
"report": {
"uniqid": "report_1",
"name": "Revenue weekly",
"type": "revenue",
"frequency": "weekly",
"format": "pdf",
"email": "[email protected]",
"downloadUrl": null
}
}
}