Accelerator Global Resources

(1 review)

home

This library defines a set of resources that are commonly used in API specifications. This helps to standardize API definitions as well as to avoid writing a lot of boilerplate definitions.

Security Schemes

This library defines a single Basic Authentication scheme called BasicAuth, which uses standard headers.

Traits

Trait NameDescriptionTypical Usage
ErrorResponsesDefines a comprehensive set of error response codesAdd to any endpoint definition
PingResponseDefines a standard structure for health reportsAdd to the /ping endpoint
PageableDefines attributes used for result set pagingApply to a GET method that supports pagination
SortableDefines attributes used for result set sortingApply to a GET method that supports sorting
TrackableDefines a header for supplying tracking informationApply to any endpoint for end-to-end traceability

Data types

Type NameDescriptionTypical Usage
BasicResponseDefines a generic API response structure, which includes an overall status code and zero or more result messagesUse for POST and other endpoints that do not return a business data response
ResultMessageDefines a generic message structure for use in API responsesUse to incorporate standard messages into non-standard responses

Usage

To use one or more of these resources in your API definition, first add this library as an Exchange dependency to your Design Center project so that you can import it into your main RAML file. For example:

uses:
  GlobalResources: exchange_modules/<groupid>/accelerator-global-resources/2.0.2/accelerator-global-resources.raml

You can then add the appropriate trait(s) to your endpoints as follows:

/health:
  description: Test connectivity to this API and back-end resources
  get:
    is: [ GlobalResources.HealthResponse ]

/accounts:
  description: Find one or more accounts matching a given set of criteria
  is: [ GlobalResources.ErrorResponses ]
  securedBy: [ GlobalResources.BasicAuth ]

Notes

If you update the version of the Exchange dependency you will need to manually update all file path references.


Reviews

TypeAPI Spec Fragment
OrganizationMuleSoft
Published by
MuleSoft Solutions
Published onApr 18, 2024
Asset overview

Asset versions for 2.2.x

Asset versions
VersionActions
2.2.2
2.2.0