Bungie-net / api

Resources for the Bungie.net API
Other
1.21k stars 92 forks source link

Getting an HTTP/2 404 when requesting basic user info #1693

Open supercarp opened 1 year ago

supercarp commented 1 year ago

I'm starting out working on a data project and am having trouble pulling basic player info. I've made successful basic JSON requests but I'm trying to simply get player info, in this case I'm using tripleWRECK.

My request is written in R, here is a summary:

bungie_url = "https://www.bungie.net/platform"
my_api_key = "5ecd2d7c50994ba78283a7acbbbdcc28"
profile_url = "/SearchDestinyPlayer/-1/tripleWRECK"
bungie_response <- GET(paste0(bungie_url,profile_url),add_headers("x-api-key" = my_api_key), progress(), verbose(), accept_json())
bungie_result = fromJSON(content(bungie_response, "text"))

and the response I'm getting back looks like:

-> GET /platform/SearchDestinyPlayer/-1/tripleWRECK HTTP/2
-> Host: www.bungie.net
-> user-agent: libcurl/7.79.1 r-curl/4.3.2 httr/1.4.3
-> accept-encoding: deflate, gzip
-> cookie: Q6dA7j3mn3WPBQVV6Vru5CbQXv0q+I9ddZfGro+PognXQwjWM8PS+VE_=v1XthRgw__Ex9; bungleanon=sv=BAAAAABIOgAAAAAAAIbXEQUAAAAAAAAAAAAAAACr4GWQhmbaCEAAAABEcbz/g4U1dl7sgQk2ZsZneCm38nLd16mFCy/eVbQ0Zj/7TLI6vhDey7v1+KG6YakZRD7nY5VoupX1rTsu30bu&cl=MC4xNDkyMC44NTA1NTM2Ng==; bungledid=B5+cvfRRyVBBnc8Ywt95LrSr4GWQhmbaCAAA; bungled=4639479971467949331; __cflb=04dToX7HjFoF4QAzoaHehFaMj5fkjPR7Ap6RnKzrRZ
-> x-api-key: 5ecd2d7c50994ba78283a7acbbbdcc28
-> accept: application/json
-> 
<- HTTP/2 404 
<- date: Fri, 15 Jul 2022 18:47:20 GMT
<- content-type: text/html; charset=UTF-8
<- cache-control: private
<- vary: Origin
<- x-bungienext-mid2: 121
<- x-bungienext-renderer: Frog Blast the Ventcore
<- x-ua-compatible: IE=edge
<- access-control-allow-origin: https://www.bungie.net
<- x-selfurl: https://www.bungie.net/platform/SearchDestinyPlayer/-1/tripleWRECK
<- x-content-type-options: nosniff
<- x-frame-options: SAMEORIGIN
<- bnetlb: LB01
<- cf-cache-status: DYNAMIC
<- expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
<- server: cloudflare
<- cf-ray: 72b4aa828c995848-IAD
<- content-encoding: gzip

From what I can tell on the 9th line down there's a 404 error and subsequently I'm not getting any player data back, I think it's returning regular http? When I attempt to view the JSON I get an error:

Error: lexical error: invalid char in json text.
                                       <?xml version="1.0" encoding="u
                     (right here) ------^
In addition: Warning message:
JSON string contains (illegal) UTF8 byte-order-mark! 

Thanks to anyone who can help.

soren42 commented 1 year ago

I think this is the same issue I responded to here. Essentially, there's a better endpoint to use.

ats commented 1 year ago

Hey cool: Another R user screwing around with Destiny 2 data! Welcome. If we get one more, we can run some strikes together.

supercarp commented 1 year ago

@soren42 Thank you for the response. I'm still getting a 404 in the response so I think there's an issue with my request format or content. Is the oauthID required in this request? I will try to figure out how to add that in. Many thanks and also apologies, I'm new to web development.

supercarp commented 1 year ago

Hey cool: Another R user screwing around with Destiny 2 data! Welcome. If we get one more, we can run some strikes together.

Halfway to a raid group :D