Get user ping hits
Get user history of his page visits via GET request.
GET
/users/:id/ping_hits/
Attributes
Type
Description
id
integer
Unique ID provided in user model
curl -X GET -H "Authorization: Token <your_64_char_api_key>" "https://<your_app_subdomain>.user.com/api/public/users/:id/ping_hits/"
Response
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 6840283,
"client": 490,
"ip_address": "12.34.56.78",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36",
"browser_family": "Chrome",
"browser_version": "52.0.2743",
"os_type": "Windows",
"city": "New York",
"country": "United States",
"url": "http://mydomain.com/page2.html",
"referer": "",
"timestamp": "2016-09-07T08:16:08.860725Z",
"extra_data": "{u'boolean_attribute': u'1'}",
"timezone": "America/New_York",
"resolution": "1920x938"
},
{
"id": 6210852,
"client": 490,
"ip_address": "12.34.56.78",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36",
"browser_family": "Chrome",
"browser_version": "52.0.2743",
"os_type": "Windows",
"city": "New York",
"country": "United States",
"url": "http://mydomain.com/page1.html",
"referer": "",
"timestamp": "2016-08-31T12:22:49.549081Z",
"extra_data": "{u'boolean_attribute': u'1'}",
"timezone": "America/New_York",
"resolution": "1920x938"
}
]
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://<your_app_subdomain>.user.com/api/public/users/:id/ping_hits/",
"method": "GET",
"headers": {
"authorization": "Token <your_64_char_api_key>"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://<your_app_subdomain>.user.com/api/public/users/:id/ping_hits/");
xhr.setRequestHeader("authorization", "Token <your_64_char_api_key>");
xhr.send(data);
var request = require("request");
var options = { method: 'GET',
url: 'https://<your_app_subdomain>.user.com/api/public/users/:id/ping_hits/',
headers: { authorization: 'Token <your_64_char_api_key>' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/users/:id/ping_hits/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => array(
"authorization: Token <your_64_char_api_key>"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://<your_app_subdomain>.user.com/api/public/users/:id/ping_hits/"
payload = ""
headers = {'authorization': 'Token <your_64_char_api_key>'}
response = requests.request("GET", url, data=payload, headers=headers)
print(response.text)
import http.client
conn = http.client.HTTPSConnection("<your_app_subdomain>.user.com")
payload = ""
headers = { 'authorization': "Token <your_64_char_api_key>" }
conn.request("GET", "/api/public/users/:id/ping_hits/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))