When testing the REST API in Preview, make sure that the credential you use is the "debug" credential. You can see this in the Credentials screen on the Portal.
For example, an example LogEventRequest in curl would look like this.
When testing the REST API in Preview, make sure that the credential you use is the "debug" credential. You can see this in the Credentials screen on the Portal.
For example, an example LogEventRequest in curl would look like this.
LogEventRequest's generally require the playerId field provided as Cloud Code runs with player context.
Let me know if this helps, and if you have any more questions please let me know.
-Pádraig
M
Marcin Olszewski
said
over 4 years ago
Thank you it works:) Also I've fixed header
T
Timothy Wood
said
over 3 years ago
If anyone else is wondering, I thought I should share this considering this is the only useful thread I've found for php. If you're trying to make a php call to mongo or to the API in general, you can go to the documentation and refer to the curl statement that Pádraigposted above.
You can find the "Try this" links in the Rest API docs which reveals quite a bit more information on post calls. Some allow you to put in your Gamespark username, password, api key and state.
Clickand it will then show your username as well as the appropriate url to make the call.
Looks like this:
Now navigate down to mongo and for this example, we'll go ahead and just use .find on a custom meta collection I've created. So, if you're following along, scroll down until you see this and then expand it.
There will be 3 fields that are required. Enter in a collection, put '{ }' in the dto input since we want to find all documents and then paste in your api key again. Hit the Try button below the input fields and you should get the results you're looking for, assuming that you have everything configured properly.
Example:
You may now copy and paste the curl statement into a curl-to-php converter to save a little time. Here's a good one that works pretty well - it will output php code which should work right out of box. Dissect it to see how it works.
Marcin Olszewski
Hi, I try to use game RestAPI over php request. I do this like described here: https://docs.gamesparks.com/api-documentation/rest-apis/requests.html#!/Events/post_rs_credential_secret_LogEventRequest but I get "NOTAUTHORIZED" or "Request not authorized"(when I use DeviceAuthRequest). What am I doing wrong(tried with and without auth token)? Code below:
Hi Marcin,
When testing the REST API in Preview, make sure that the credential you use is the "debug" credential. You can see this in the Credentials screen on the Portal.
For example, an example LogEventRequest in curl would look like this.
LogEventRequest's generally require the playerId field provided as Cloud Code runs with player context.
Let me know if this helps, and if you have any more questions please let me know.
-Pádraig
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
Hi Marcin,
When testing the REST API in Preview, make sure that the credential you use is the "debug" credential. You can see this in the Credentials screen on the Portal.
For example, an example LogEventRequest in curl would look like this.
LogEventRequest's generally require the playerId field provided as Cloud Code runs with player context.
Let me know if this helps, and if you have any more questions please let me know.
-Pádraig
Marcin Olszewski
Timothy Wood
You can find the "Try this" links in the Rest API docs which reveals quite a bit more information on post calls. Some allow you to put in your Gamespark username, password, api key and state.
This one is a good example of this:
Click
and it will then show your username as well as the appropriate url to make the call.
Looks like this:
Now navigate down to mongo and for this example, we'll go ahead and just use .find on a custom meta collection I've created. So, if you're following along, scroll down until you see this and then expand it.
There will be 3 fields that are required. Enter in a collection, put '{ }' in the dto input since we want to find all documents and then paste in your api key again. Hit the Try button below the input fields and you should get the results you're looking for, assuming that you have everything configured properly.
Example:
You may now copy and paste the curl statement into a curl-to-php converter to save a little time. Here's a good one that works pretty well - it will output php code which should work right out of box. Dissect it to see how it works.
https://incarnate.github.io/curl-to-php/
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2486 topics