OS1 Services
Order Service

Order Validation and Enrichment Plugins

4min

The Order Service allows the configuration of one or more external plugins or webhooks for the initiated order. These plugins can be used for validating the order and/or enrichment of the order.

Some examples of the use cases for plugins are as follows:

  • Serviceability check.
  • Unique location ID computation for consignee address.
  • Determining the client warehouse for pickup.
  • End-to-end SLA computation for the order.

Creating Plugin

To create a Plugin, call the POST /plugins endpoint and pass the following parameters in the request body:

Parameter

Description

Remarks

name

Name of the Plugin.

Data type: string Character length: 3-50

httpUrl

URL endpoint to be called when the plugin is executed.

Data type: string

httpMethod

API method with which the endpoint is called.

Data type: stringValid values: POST, GET, and PUT

httpHeaders (optional)

Headers - used to make the API call.



httpRequestBodyTemplate

Request payload body with which the API needs to be called.



requestTimeout (optional)



Data type: string

callbackTimeout (optional)



Data type: string

The following sample payload shows how to create a new Plugin named validationTypetest:

POST /plugins


Creating Plugin Workflow

If you have more than one external plugin or webhook for the initiated order, you need to create a plugin workflow. This workflow will define the sequence in which the plugins will be executed (in case of more than one plugin).

To create a Plugin Workflow, call the POST /plugin-workflows endpoint and pass the following parameters in the request body:

Parameter

Description

Remarks

name

Name of the Plugin.

Data type: string Character length: 3-50

event

Type of Plugin.

Data type: string Character length: 3-50

workflow

Workflow details.



workflow: name

Name of the Workflow.

Data type: string Character length: 3-50

workflow: start

The Plugin with which the Workflow begins executing.

Data type: string

workflow: description

Description of the Workflow.

Data type: string Character length: 3-256

workflow: tag

Tags of the Workflow with tag name and value.

Data type: string Character length: 3-50

flows: name

Name of the flow.

Data type: string Character length: 3-50

flows: pluginId

The ID of the Plugin to be executed.

Data type: string

flows: description

Description of the flow.

Data type: string Character length: 3-256

flows: next

The next flow for execution.



flows: next: plugin

The plugin that will come into action.

Data type: string Character length: 3-256

flows: next: condition

Condition on which this next Plugin will be executed.



The following sample request body shows how to create a new Plugin Workflow named test:

POST /plugin-workflows