Developers
paul_harrington
—
2015-08-10T18:57:48-04:00 —
#1
Hi,
I have the following code where I am attempting to play an action and I am getting an exception thrown -
{"You are not allowed to access this api route"}. I do not know if I am calling the API correctly as I feel that the documentation is a poor in this area. An example would be very useful.
The code is below and I am using the C# SDK.
public void AddUnitTestPoints()
{
if (SelectedPlayer != null)
{
try
{
var player_id = new Dictionary<string, string>() { { "player_id", SelectedPlayer.PlayerId } };
var body = new Dictionary<string, string>() { { "count", "2" } };
var result = plCode.post(
route: "runtime/actions/create_new_unit_test/play",
query: player_id,
body: body,
list: true);
}
catch (Exception)
{
throw;
}
}
}
paul_harrington
—
2015-08-18T17:54:23-04:00 —
#2
Anyone from Playlyfe have any suggestions as to what is going on? It has been 8 days now!!
peter_john
—
2015-08-19T01:13:27-04:00 —
#3
Sorry It seems I'm not getting any mails from the forums.. And with a lot of work we neglected to see this
peter_john
—
2015-08-19T01:26:36-04:00 —
#4
This happens when the client that you created does not have permissions to access that route. With what permissions did you create his client. To use the /runtime
routes you need to select the player.runtime.read
and player.runtime.write
scopes and then the request will pass.
https://cloud.githubusercontent.com/assets/1687946/9349193/e00fe91c-465f-11e5-8094-6e03c64a662c.png
If you are having problems with your the SDK's, you can actually try out the request here
https://dev.playlyfe.com/docs/api/v2/runtime.html#/POSTActionPlayAnAction ... And if you see the response there, it is actually a JSONObject with 2 keys actions and events so then you don't new pass the list: true parameter as this might mess up the type conversion
And right now we dont have much examples but there are the test cases and you can use that client id and client secret which has all permissions by default to test it out also ... https://github.com/playlyfe/playlyfe-csharp-sdk/blob/master/test/Test.cs#L122