java.lang.Object
com.bonitasoft.processbuilder.extension.template.catalog.RestApiCatalog

public final class RestApiCatalog extends Object
Catalog of predefined REST API templates.

Provides factory methods for:

  • Common APIs (OpenWeatherMap, NASA, GitHub, etc.)
  • Generic templates for each authentication type
  • Bonita BPM remote instance connectivity

Usage in Groovy script:


 import com.bonitasoft.processbuilder.extension.template.catalog.RestApiCatalog
 import com.fasterxml.jackson.databind.ObjectMapper

 def mapper = new ObjectMapper()

 // Get template and convert to JSON string for configValue
 def template = RestApiCatalog.openWeatherMap("your-api-key")
 def configValue = template.toJsonString(mapper)
 
Since:
2025-02-06
Author:
Process Builder Team
  • Method Details

    • getAllTemplateNames

      public static List<String> getAllTemplateNames()
      Returns all available template type names.
      Returns:
      Unmodifiable list of all template names
    • getAllTemplatesInfo

      public static Map<String,String> getAllTemplatesInfo()
      Returns all template types as a map of displayName to description.
      Returns:
      Unmodifiable map with displayName as key and description as value
    • getTemplatesRequiringCredentials

      public static List<RestApiCatalog.TemplateType> getTemplatesRequiringCredentials()
      Returns all template types that require user credentials.
      Returns:
      Unmodifiable list of templates requiring credentials
    • getFreeTemplates

      public static List<RestApiCatalog.TemplateType> getFreeTemplates()
      Returns all template types that are free (no credentials needed).
      Returns:
      Unmodifiable list of free templates
    • getTemplatesByAuthType

      public static List<RestApiCatalog.TemplateType> getTemplatesByAuthType(RestApiCatalog.AuthType authType)
      Returns all template types filtered by authentication type.
      Parameters:
      authType - The authentication type to filter by
      Returns:
      Unmodifiable list of templates using the specified auth type
    • getTemplateCount

      public static int getTemplateCount()
      Returns the total count of available templates.
      Returns:
      Number of templates in the catalog
    • noAuth

      public static RestApiTemplate.Builder noAuth(String name, String displayName, String baseUrl)
      Creates a generic template with NO authentication.
      Parameters:
      name - Template name (fullName in PBConfiguration)
      displayName - Human-readable name
      baseUrl - Base URL of the API
      Returns:
      Template builder pre-configured with no auth
    • basicAuth

      public static RestApiTemplate.Builder basicAuth(String name, String displayName, String baseUrl, String username, String password)
      Creates a generic template with BASIC authentication.
      Parameters:
      name - Template name
      displayName - Human-readable name
      baseUrl - Base URL of the API
      username - Username for Basic auth
      password - Password for Basic auth
      Returns:
      Template builder pre-configured with Basic auth
    • bearerAuth

      public static RestApiTemplate.Builder bearerAuth(String name, String displayName, String baseUrl, String token)
      Creates a generic template with BEARER token authentication.
      Parameters:
      name - Template name
      displayName - Human-readable name
      baseUrl - Base URL of the API
      token - Bearer token
      Returns:
      Template builder pre-configured with Bearer auth
    • apiKeyHeader

      public static RestApiTemplate.Builder apiKeyHeader(String name, String displayName, String baseUrl, String keyName, String keyValue)
      Creates a generic template with API KEY in HEADER.
      Parameters:
      name - Template name
      displayName - Human-readable name
      baseUrl - Base URL of the API
      keyName - Header name for the API key
      keyValue - API key value
      Returns:
      Template builder pre-configured with API Key in header
    • apiKeyQuery

      public static RestApiTemplate.Builder apiKeyQuery(String name, String displayName, String baseUrl, String keyName, String keyValue)
      Creates a generic template with API KEY in QUERY parameter.
      Parameters:
      name - Template name
      displayName - Human-readable name
      baseUrl - Base URL of the API
      keyName - Query parameter name for the API key
      keyValue - API key value
      Returns:
      Template builder pre-configured with API Key in query
    • oauth2ClientCredentials

      public static RestApiTemplate.Builder oauth2ClientCredentials(String name, String displayName, String baseUrl, String tokenUrl, String clientId, String clientSecret, String scope)
      Creates a generic template with OAuth2 Client Credentials.
      Parameters:
      name - Template name
      displayName - Human-readable name
      baseUrl - Base URL of the API
      tokenUrl - OAuth2 token endpoint
      clientId - OAuth2 client ID
      clientSecret - OAuth2 client secret
      scope - OAuth2 scope (can be null)
      Returns:
      Template builder pre-configured with OAuth2 Client Credentials
    • oauth2Password

      public static RestApiTemplate.Builder oauth2Password(String name, String displayName, String baseUrl, String tokenUrl, String clientId, String username, String password)
      Creates a generic template with OAuth2 Password Grant.
      Parameters:
      name - Template name
      displayName - Human-readable name
      baseUrl - Base URL of the API
      tokenUrl - OAuth2 token endpoint
      clientId - OAuth2 client ID
      username - Resource owner username
      password - Resource owner password
      Returns:
      Template builder pre-configured with OAuth2 Password Grant
    • jsonPlaceholder

      public static RestApiTemplate jsonPlaceholder()
      JSONPlaceholder - Free fake REST API for testing.
    • restCountries

      public static RestApiTemplate restCountries()
      REST Countries API - Country information.
    • openWeatherMap

      public static RestApiTemplate openWeatherMap(String apiKey)
      OpenWeatherMap API - Weather data.
      Parameters:
      apiKey - Your OpenWeatherMap API key (get free at openweathermap.org)
    • nasaApod

      public static RestApiTemplate nasaApod(String apiKey)
      NASA APOD API - Astronomy Picture of the Day.
      Parameters:
      apiKey - Your NASA API key (use "DEMO_KEY" for testing)
    • httpBinBasicAuth

      public static RestApiTemplate httpBinBasicAuth()
      HTTPBin Basic Auth test service.
    • bonitaRemote

      public static RestApiTemplate bonitaRemote(String baseUrl, String username, String password)
      Bonita BPM Remote Instance - Connect to another Bonita server.
      Parameters:
      baseUrl - Bonita server URL (e.g., "http://localhost:8080")
      username - Bonita username
      password - Bonita password
    • gitHub

      public static RestApiTemplate gitHub(String token)
      GitHub API - Requires Personal Access Token.
      Parameters:
      token - GitHub Personal Access Token
    • slack

      public static RestApiTemplate slack(String botToken)
      Slack Web API - Team communication.
      Parameters:
      botToken - Slack Bot Token (xoxb-...)
    • notion

      public static RestApiTemplate notion(String integrationToken)
      Notion API - Workspace platform.
      Parameters:
      integrationToken - Notion Integration Token
    • hubSpot

      public static RestApiTemplate hubSpot(String apiKey)
      HubSpot CRM API.
      Parameters:
      apiKey - HubSpot API key
    • sendGrid

      public static RestApiTemplate sendGrid(String apiKey)
      SendGrid Email API.
      Parameters:
      apiKey - SendGrid API key
    • jira

      public static RestApiTemplate jira(String domain, String email, String apiToken)
      Jira REST API - Atlassian issue tracking.
      Parameters:
      domain - Jira domain (e.g., "yourcompany.atlassian.net")
      email - User email
      apiToken - API token from id.atlassian.com
    • zendesk

      public static RestApiTemplate zendesk(String subdomain, String email, String apiToken)
      Zendesk Support API.
      Parameters:
      subdomain - Zendesk subdomain (e.g., "yourcompany")
      email - Agent email
      apiToken - API token from Admin > Channels > API
    • sapBusinessOne

      public static RestApiTemplate sapBusinessOne(String baseUrl, String username, String password)
      SAP Business One Service Layer.
      Parameters:
      baseUrl - SAP B1 Service Layer URL (e.g., "https://server:50000/b1s/v1")
      username - SAP B1 username
      password - SAP B1 password
    • salesforce

      public static RestApiTemplate salesforce(String instanceUrl, String clientId, String clientSecret)
      Salesforce REST API.
      Parameters:
      instanceUrl - Salesforce instance URL (e.g., "https://yourorg.my.salesforce.com")
      clientId - Connected App Consumer Key
      clientSecret - Connected App Consumer Secret
    • sapS4Hana

      public static RestApiTemplate sapS4Hana(String baseUrl, String tokenUrl, String clientId, String clientSecret)
      SAP S/4HANA OData API.
      Parameters:
      baseUrl - SAP S/4HANA API endpoint
      tokenUrl - OAuth2 token URL from SAP BTP
      clientId - OAuth2 client ID
      clientSecret - OAuth2 client secret
    • dynamics365

      public static RestApiTemplate dynamics365(String orgUrl, String tenantId, String clientId, String clientSecret)
      Microsoft Dynamics 365 Web API.
      Parameters:
      orgUrl - Dynamics 365 organization URL (e.g., "https://yourorg.crm.dynamics.com")
      tenantId - Azure AD tenant ID
      clientId - Azure AD application (client) ID
      clientSecret - Azure AD client secret
    • serviceNow

      public static RestApiTemplate serviceNow(String instanceUrl, String clientId, String clientSecret)
      ServiceNow REST API.
      Parameters:
      instanceUrl - ServiceNow instance URL (e.g., "https://yourinstance.service-now.com")
      clientId - OAuth2 client ID
      clientSecret - OAuth2 client secret
    • workday

      public static RestApiTemplate workday(String tenant, String tokenUrl, String clientId, String clientSecret)
      Workday REST API.
      Parameters:
      tenant - Workday tenant name
      tokenUrl - OAuth2 token endpoint
      clientId - OAuth2 client ID
      clientSecret - OAuth2 client secret
    • docuSign

      public static RestApiTemplate docuSign(String accountId, String tokenUrl, String clientId, String userId, String privateKey)
      DocuSign eSignature API.
      Parameters:
      accountId - DocuSign account ID
      tokenUrl - OAuth2 token URL
      clientId - Integration Key (client ID)
      userId - User ID (for JWT)
      privateKey - RSA private key
    • getAllTemplateDefinitions

      public static List<RestApiTemplate> getAllTemplateDefinitions()
      Returns all template definitions as a list.

      These templates include placeholder values ({{baseUrl}}, {{username}}, etc.) that users must fill in when creating actual API configurations.

      Returns:
      List of all template definitions
    • templateNoAuth

      public static RestApiTemplate templateNoAuth()
      Template: REST API - No Authentication. Generic template for public APIs without authentication.
    • templateBasicAuth

      public static RestApiTemplate templateBasicAuth()
      Template: REST API - Basic Authentication. Generic template for APIs using HTTP Basic Auth.
    • templateBearerToken

      public static RestApiTemplate templateBearerToken()
      Template: REST API - Bearer Token. Generic template for APIs using Bearer token authentication.
    • templateApiKey

      public static RestApiTemplate templateApiKey()
      Template: REST API - API Key. Generic template for APIs using API Key authentication.
    • templateOAuth2ClientCredentials

      public static RestApiTemplate templateOAuth2ClientCredentials()
      Template: REST API - OAuth2 Client Credentials. Generic template for APIs using OAuth2 Client Credentials flow (M2M).
    • templateOAuth2Password

      public static RestApiTemplate templateOAuth2Password()
      Template: REST API - OAuth2 Password Grant. Generic template for APIs using OAuth2 Password Grant flow.
    • templateCustomHeaders

      public static RestApiTemplate templateCustomHeaders()
      Template: REST API - Custom Headers. Generic template for APIs using custom authentication headers.
    • templateJsonPlaceholder

      public static RestApiTemplate templateJsonPlaceholder()
      Template: JSONPlaceholder - Free test API.
    • templateRestCountries

      public static RestApiTemplate templateRestCountries()
      Template: REST Countries - Free countries API.
    • templateOpenWeatherMap

      public static RestApiTemplate templateOpenWeatherMap()
      Template: OpenWeatherMap - Weather data API.
    • templateExchangeRate

      public static RestApiTemplate templateExchangeRate()
      Template: ExchangeRate-API - Free currency rates.
    • templateIPGeolocation

      public static RestApiTemplate templateIPGeolocation()
      Template: IP-API - Free IP geolocation.
    • templateCompaniesHouseUK

      public static RestApiTemplate templateCompaniesHouseUK()
      Template: Companies House UK - UK company registry.
    • templateVIESVat

      public static RestApiTemplate templateVIESVat()
      Template: VIES VAT Validation - EU VAT validation.
    • templateClearbit

      public static RestApiTemplate templateClearbit()
      Template: Clearbit - Data enrichment API.
    • templateAbstractEmailValidation

      public static RestApiTemplate templateAbstractEmailValidation()
      Template: Abstract Email Validation.
    • templateNumVerify

      public static RestApiTemplate templateNumVerify()
      Template: NumVerify - Phone validation.
    • templateAlphaVantage

      public static RestApiTemplate templateAlphaVantage()
      Template: Alpha Vantage - Financial data.
    • templateSapS4Hana

      public static RestApiTemplate templateSapS4Hana()
      Template: SAP S/4HANA OData API.
    • templateHubSpot

      public static RestApiTemplate templateHubSpot()
      Template: HubSpot CRM.
    • templateMicrosoftGraph

      public static RestApiTemplate templateMicrosoftGraph()
      Template: Microsoft Graph API.
    • templateServiceNow

      public static RestApiTemplate templateServiceNow()
      Template: ServiceNow ITSM.
    • templateDocuSign

      public static RestApiTemplate templateDocuSign()
      Template: DocuSign eSignature.
    • templateStripe

      public static RestApiTemplate templateStripe()
      Template: Stripe Payments.
    • templateSlack

      public static RestApiTemplate templateSlack()
      Template: Slack Web API.
    • templateGoogleDrive

      public static RestApiTemplate templateGoogleDrive()
      Template: Google Drive API.
    • templateJira

      public static RestApiTemplate templateJira()
      Template: Jira Cloud.
    • templateOneDrive

      public static RestApiTemplate templateOneDrive()
      Template: Microsoft OneDrive.
    • templateSalesforce

      public static RestApiTemplate templateSalesforce()
      Template: Salesforce CRM.
    • templateAlfresco

      public static RestApiTemplate templateAlfresco()
      Template: Alfresco Content Services.
    • templateBonitaUniversal

      public static RestApiTemplate templateBonitaUniversal()
      Template: Bonita BPM Universal (30 methods).