Totara Talent Experience Platform Open Discussions

External API custom endpoints

 
Gabriel Baierle
Re: External API custom endpoints
by Gabriel Baierle - Saturday, 4 November 2023, 1:11 PM
 

Following the docs I've created the following structure:

  • local/plugin/webapi/external/get_completions.graphql

query local_plugin_get_completions{

local_plugin_get_completions{ id }

}

  • local/plugin/webapi/external/schema.graphqls

extend type Query {

local_plugin_get_completions: [local_plugin_get_completions!]!

}

type local_plugin_get_completions{

id: core_id,

}

  • local/plugin/classes/webapi/resolver/query

class get_completions extends \core\webapi\query_resolver {

public static function resolve(array $args, execution_context $ec) {

return [ 'id' => 'test' ];

}

}

When sending the request, I get a 200 response with empty data, no error in the server side. What am I missing here or how shauld I add new queries to the Totara External GraphQL API?