Skip to content

Martini Generating Services when Consuming GraphQL APIs

Martini's graphical interface streamlines the creation of services from GraphQL schemas, facilitating quick integration with GraphQL APIs. Follow these steps to generate services in Martini from a GraphQL schema.

Importing an GraphQL Schema

  1. Navigate to the Consume API Interface: In Martini, open the Navigator view.

  2. Start the Consume API Wizard: Right-click on your target package and select “New | Consume API” from the context menu to launch the Consume an API wizard.

  3. Complete the Required Values:

  4. Location: Browse to the directory within your package where you would like your generated services saved.

  5. Source: Select GraphQL Schema
  6. File/URL: Provide the file path or enter the URL for the GraphQL schema.

  7. Optional Settings: To track events in the Tracker Transaction log, check "Log requests to Tracker." Note that logging to the Tracker may add overhead and consume additional database resources.

  8. Complete the Import: Click “Consume” to generate services from the GraphQL API specification. Martini will generate a service for each operation defined in the API specification, saving them to the specified directory.

Post-Generation Steps

After generating the services, you may need to take additional steps:

  • Customize Generated Services: Review the autogenerated service components and customize queries, mutations, or subscriptions as needed to suit your business logic.
  • Test Services: Invoke the generated services and ensure they interact with the GraphQL API as expected.
  • Secure the Services: If your GraphQL API requires authentication, ensure that the necessary headers or tokens are configured in the authentication service inputs.