Some PUBG API returning 404 - json

Some PUBG API endpoints are returning 404 with the message "Player Not Found"
I've checked that my API key is working properly because I can successfully query other endpoints.
I'm using postman to submit a GET request to the following address:
https://api.pubg.com/shards/steam/players/13DEMAH
I have the following two items included in my header:
Authorization: Bearer myApiKey
accept: application/vnd.api+json
A link to the PUBG documentation: PUBG Documentation
If anyone knows what I'm doing wrong it would be really helpful because I can't figure it out!

What you are doing wrong is that you are using this endpoint /players/{accountId} which require the internal ID in the PUBG API.
So what you can use is:
https://api.pubg.com/shards/steam/players?filter[playerNames]=13DEMAH
To get the information about a PUBG username. (you can also use this endpoint to fetch up to 10 players stats)

Related

Rest call failed with client error, status code 406 NotAcceptable

When I test with Advanced Rest Client(Arc) all nine API calls to REST API works fine.
I use method Get with two headers the first is Authorization Bearer
the second one is Content-type application/json. It works even if I remove
header Content-type application/json
Here is a screenshot of the response from Arc. This same REST API call give error from Azure Data Factory(ADF).
Sceenshot from Arc
I call nine REST API from Azure Data Factory(ADF) with the same base url but different Relative URL.
Out of these nine 6 works perfect.
When I use Azure Data Factory(ADF) I use additional header
Authorization Bearer #{activity('GetToken').output.access}
What is strange is that the exact same call from Arc works fine but I get error when I call from ADF. Note also that I get the exact same error if I remove the additional header
Authorization Bearer #{activity('GetToken').output.access}
I mean that the code in REST API doesn't know if the call is comming from Arc or ADF.
Note also the the error is from the source side so my call to REST API with method GET
can't be handled by the REST API code for some reason.
According to the documentation for the REST API it says that
Headers Content-type application/json and
Authorization Bearer
I tried to add a second additional header in ADF Headers Content-type application/json
but I get REST connector ignores any "Content-Type" header specified in additional headers when request body is empty.
I have tried to find any sensible information about my error but there no one that have had any similar. What I find very strange is that 6 Rest API calls works fine and the json that we receive when using Arc is valid.
I don't realy understand the error message when saying
Requested format \u0022application/json\u0022 is not supported
Supported MIME types are \u0022application/ld+json\u0022
Here is the complete error message I get Screen shot of error message for ADF
Your response data is JSON LD (Json linked data). Hence you are seeing this error.
To avoid this error use Content-Type header value as application/ld+json.

CORS headers missing from response when POST with invalid JSON in AWS Api Gateway API

We have an AWS API Gateway API that works for CORS most of the time. The only exception is when POSTing with invalid JSON, when CORS headers are missing from the response. If it is a valid JSON but it fails data validation, then the CORS headers are correctly set. I tried to reset the root resource by 'enable CORS' for root resource and redeploy, the same situation.
Just wondering if anyone has seen this before and how to fix it. Thanks
found the answer myself. If APIG has not reached integration in this case, need to customize the gateway response
https://docs.aws.amazon.com/apigateway/latest/developerguide/customize-gateway-responses.html

yii2 send API request command

Need to execute the following API call:
GET /v1/users HTTP/1.1
Host: https://api.someserver.com
Authorization: Bearer MyT0KenGoesH3r3
so far for Yii2 there is lots of documentation about creating your own API, but not how to send a query. Do I need an extension to do this, or am I looking at something like https://github.com/guzzle/guzzle?
There is a HTTP Client Extension for Yii 2. Take a look at https://github.com/yiisoft/yii2-httpclient

Parse API GET Request

If I have a Parse.com API with applicationId APPLICATION_ID and REST-API-Key REST_API_KEY, and the classname is Story, then what should the GET request structure look like. I tried the following :
https://api.parse.com/1/story/applicationId=APPLICATION_ID&REST-API-Key=REST_API_KEY
but it didn't work.
#Das According to Parse API
Authentication is done via HTTP headers.
So, your request should be
*GET /1/stories/story HTTP/1.1
Host : api.parse.com
Accept: application/json
X-Parse-Application-Id: APPLICATION_ID
X-Parse-REST-API-Key: REST_API_KEY*
When we need to use headers, the Get request can not be formed within a single URL,
Postman chrome extension would be helpful to construct the requests
or fiddler.
When you are using postman, to fill the header details, take the HTTP Verb as POST and use
X-Http-Method-Override: GET header to make it a GET request.
Hope this helps

unexpected token : from angular $http.jsonp request to Instagram API

I'm making a request to an authorized Instagram account to display images on a site. Originally, I was running into No 'Access-Control-Allow-Origin' when using Angular's $http.get(....
From Matt's answer in this question, It seems that I can use getJSON, or Angular $http.jsonp, to bypass this issue. That Guy's answer also says "JSONP is really a simply trick to overcome XMLHttpRequest same domain policy".
So, I'm no longer getting that problem, and am getting a json payload:
{"pagination":{"next_url":"https:\/\/api.instagram.com... etc
But am getting a very ambiguous error:
Uncaught SyntaxError: Unexpected token :
This is a response from the Instagram API, so I'm not sure why there'd be a syntax error on the inbound json. Also, It's hard to locate the error since the jsonp response is all on a single line... where the error is reported.
The preview shows that I'm getting a full payload:
I found the issue. Unfortunately there are no JavaScript libraries to help with this, but in the Instagram API docs, for JSONP you can wrap the response with a callback so that the json payload will be wrapped in <script> tags (more info on jsonp here), therefore not blocked by Access Control Allow Origin.
https://api.instagram.com/v1/tags/coffee/media/recent?access_token=ACCESS-TOKEN&callback=callbackFunction
Response:
callbackFunction({
...
});
So, in your http request URI, you add in a callback parameter. Since I am using Angular, their docs for $http.jsonp() requests specify the callback string as "JSON_CALLBACK".
So, my request URL for Angular would be:
$http.jsonp(
'https://api.instagram.com/v1/tags/coffee/media/recent?
access_token=ACCESS-TOKEN&callback=JSON_CALLBACK')
.success(function(data) {...