Open bmattoso opened 7 months ago
Example of create new log play on BGG API:
curl -b $cookiefile --request POST 'https://www.boardgamegeek.com/geekplay.php' -d "ajax=1&action=save&objecttype=thing&objectid=$objectid&playdate=$geekdate&location=$location&quantity=$quantity
Gist of example:
Evidence in Chrome's console:
curl:
curl 'https://boardgamegeek.com/geekplay.php' \
-H 'accept: application/json, text/plain, */*' \
-H 'accept-language: en-CA,en;q=0.9,pt-BR;q=0.8,pt;q=0.7,en-US;q=0.6' \
-H 'content-type: application/json;charset=UTF-8' \
-H 'cookie: _gid=GA1.2.1951526359.1712584308; bggusername=bmattoso; bggpassword=AAAAAAAAAAA; SessionID=4a1337d08340c90535e9b1cf20d114c0d173feefu3851333; _ga=GA1.1.1474479763.1712584308; _ga_GMNMCY4DVM=GS1.1.1712624132.6.1.1712630330.0.0.0; FCNEC=%5B%5B%22AKsRol8cYmYas5eUA7_l44mEDcl3ul52t1UPFjXmyjTqLPTdFDVOXouvtoq87feR2pYOgvhRyBW_1rbJnW2iH2bDQt71iGviPQ8k9Zs8bSpc71yl_Eo7QqYrzgBUnaSmyPsVuf7Xq4g8dZ4yZZ0To0lwOXgR6mx2RQ%3D%3D%22%5D%5D' \
-H 'origin: https://boardgamegeek.com' \
-H 'referer: https://boardgamegeek.com/boardgame/167791/terraforming-mars' \
-H 'sec-ch-ua: "Google Chrome";v="123", "Not:A-Brand";v="8", "Chromium";v="123"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: same-origin' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36' \
--data-raw '{"players":[{"name":"Bruno Mattoso","username":"bmattoso","userid":3851333,"avatarfile":"","avatar":false,"selected":false},{"name":"Elis Azevedo","username":"","disambiguator":0.6619701542445517,"selected":false}],"quantity":1,"date":"2024-03-30T03:00:00.000Z","twitter":false,"minutes":120,"hours":0,"userfilter":"","objecttype":"thing","objectid":"167791","playdate":"2024-03-30","length":120,"ajax":1,"action":"save"}'
Request payload:
{
"players": [
{
"name": "Bruno Mattoso",
"username": "bmattoso",
"userid": 3851333,
"avatarfile": "",
"avatar": false,
"selected": false
},
{
"name": "Elis Azevedo",
"username": "",
"disambiguator": 0.6619701542445517,
"selected": false
}
],
"quantity": 1,
"date": "2024-03-30T03:00:00.000Z",
"twitter": false,
"minutes": 120,
"hours": 0,
"userfilter": "",
"objecttype": "thing",
"objectid": "167791",
"playdate": "2024-03-30",
"length": 120,
"ajax": 1,
"action": "save"
}
Important: We must create the logged user cookie to log any play.
BGG Forum Log play
thread: https://boardgamegeek.com/thread/1531606/log-play-via-api
BGG API Doc: https://boardgamegeek.com/wiki/page/BGG_XML_API2 BGG API Tools: https://boardgamegeek.com/guild/1229
Request examples:
Alternative ludopedia API: https://ludopedia.com.br/api/documentacao.html#section/Introducao
Set up API integration for retrieving board game information from external sources (e.g., BoardGameGeek API) or Ludopedia