Learning platform.api.get

I’m trying to get my feet wet here with Custom Script Services written in PHP; I just want to call the built in mysql service from my custom script. This is all the code I thought I’d need:

$thing = platform.api.get(‘mysql/_table’);
return $thing;

Obviously, I’m wrong, because this is the $thing that I get:


Please save me from another late-night encounter between my head and the wall.

Check out this blog post it has examples to custom scripting services.

Hope you have created the appropriate user role and provided necessary access to the mysql service.

We have some PHP examples here. The last one shows how to use platform.api.


Thanks for the responses. This tutorial lead us down the right path. Here’s my working result without all the extra fluff:

$test = $platform[‘api’];
$get = $test->get;
$thing = $get(‘mysql/_table’);

I believe we had the roles set correctly, but just for those who are on the same learning curve…this is what I think I know about that:

  1. Make sure you have a role assigned to the service you are trying to use and that under the access tab you select the “script” requester option.
  2. Make sure whatever app api key you are trying to use has that role assigned to it

And since I have your attention and I’m in a sharing mood, may I suggest this DF wiki page?