Count a view of a project's page
curl --request POST \
--url https://patch.gg/api/v1/projects/{owner}/{slug}/views \
--header 'Content-Type: application/json' \
--data '
{
"visitor": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({visitor: '<string>'})
};
fetch('https://patch.gg/api/v1/projects/{owner}/{slug}/views', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://patch.gg/api/v1/projects/{owner}/{slug}/views"
payload = { "visitor": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"stats": {
"plays": 123,
"views": 123,
"likes": 123,
"remixes": 123
},
"liked": true
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}Projects
Count a view of a project's page
Patch’s pages send this each time someone opens a project’s page, refreshes included. Bots (by user agent) aren’t counted. Answers its public stats.
POST
/
projects
/
{owner}
/
{slug}
/
views
Count a view of a project's page
curl --request POST \
--url https://patch.gg/api/v1/projects/{owner}/{slug}/views \
--header 'Content-Type: application/json' \
--data '
{
"visitor": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({visitor: '<string>'})
};
fetch('https://patch.gg/api/v1/projects/{owner}/{slug}/views', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://patch.gg/api/v1/projects/{owner}/{slug}/views"
payload = { "visitor": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"stats": {
"plays": 123,
"views": 123,
"likes": 123,
"remixes": 123
},
"liked": true
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}Body
application/json