Count a start of a game by someone not signed in
curl --request POST \
--url https://patch.gg/api/v1/projects/{owner}/{slug}/plays \
--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}/plays', 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}/plays"
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,
"play": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"heartbeat_s": 123
}
}{
"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 start of a game by someone not signed in
The play page sends this when a browser game starts for someone who isn’t signed in. A signed-in player’s start is their play session (POST /me/play-sessions), so from them this counts nothing. Answers its public stats, and the play’s id, for timing how long it lasts.
POST
/
projects
/
{owner}
/
{slug}
/
plays
Count a start of a game by someone not signed in
curl --request POST \
--url https://patch.gg/api/v1/projects/{owner}/{slug}/plays \
--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}/plays', 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}/plays"
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,
"play": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"heartbeat_s": 123
}
}{
"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
Response
Its stats now