Routing ruleset API (1.0.0)
Download OpenAPI specification:Download
Define routing rules for your business
Get routing rules
Retrieves the current 'Routing Rule V2'. If customer using V1, this endpoint maps the V1 configuration to V2 and returns a 200 OK.
Authorizations:
Responses
Response samples
- 200
- 404
- 500
{- "routes": [
- {
- "fulfilled_by": {
- "2_DAY": [
- "2_DAY::WEST"
], - "GROUND": [
- "GROUND::WEST"
]
}, - "destination_region": {
- "country": "US",
- "zip_code_region": "WEST"
}
}
], - "sl_levels_priority": [
- "GROUND",
- "2_DAY"
], - "location_groups": {
- "2_DAY::WEST": [
- "DC01",
- "US15",
- "US16"
], - "GROUND::WEST": [
- "US01",
- "US02",
- "US03"
]
}, - "zip_code_regions": {
- "WEST": [
- "*"
]
}
}Updates the routing rules
This endpoint is used to initially seed the routing rules or to replace it completely
Note:
- You have the option of defining route entries with a single
countryor multiplecountriesby providing the optionalContent-Typeheader with your desired payload version. - If you'd like to define multiple countries set the Content-Type header to application/json; version=1. Select the appropriate Content-Type in the the request schema drop-down to see the schema for supporting multiple countries.
Authorizations:
Request Body schema:
Array of objects Routing rules specification | |
| sl_levels_priority | Array of strings non-empty [ items non-empty ] Service levels priority. This is ordered according to which service level will be taken first |
object Location groups identifiers | |
object Zip code groups, in order to facilitate the identification routes per regions |
Responses
Request samples
- Payload
{- "routes": [
- {
- "fulfilled_by": {
- "2_DAY": [
- "2_DAY::WEST"
], - "GROUND": [
- "GROUND::WEST"
]
}, - "destination_region": {
- "country": "US",
- "zip_code_region": "WEST"
}
}
], - "sl_levels_priority": [
- "GROUND",
- "2_DAY"
], - "location_groups": {
- "2_DAY::WEST": [
- "DC01",
- "US15",
- "US16"
], - "GROUND::WEST": [
- "US01",
- "US02",
- "US03"
]
}, - "zip_code_regions": {
- "WEST": [
- "*"
]
}
}Response samples
- 201
- 400
- 500
{- "routing_ruleset": {
- "routes": [
- {
- "fulfilled_by": {
- "2_DAY_PR": [
- "NJ"
]
}, - "destination_region": {
- "country": "PR",
- "zip_code_region": "All"
}
}
], - "sl_levels_priority": [
- "2_DAY_PR"
], - "location_groups": {
- "NJ": [
- "US_NJ"
]
}, - "zip_code_regions": {
- "All": [
- "*"
]
}
}, - "fulfillment_config_uri": "v0/fulfillment_configuration/revision/13"
}Patch the routing rules
A convenience endpoint is where you use JSON patch to change parts of routing rules.
Note:
- You have the option of defining route entries with a single
countryor multiplecountriesby providing the optionalContent-Typeheader with your desired payload version. - If you'd like to define multiple countries set the Content-Type header to application/json; version=1. Select the appropriate Content-Type in the the request schema drop-down to see the schema for supporting multiple countries.
- To use payload version 1 via the PATCH operation you need to update the route entries from
countrytocountriesvia PUT endpoint for compatibility.
Authorizations:
Request Body schema:
| path required | string A JSON Pointer path. |
| op required | string Enum: "add" "replace" "test" The operation to perform. |
| value required | any The value to add, replace or test. |
Responses
Request samples
- Payload
[- {
- "op": "add",
- "path": "/location_groups/2_DAY::WEST/-",
- "value": "US10"
}
]Response samples
- 200
- 400
- 500
{- "routing_ruleset": {
- "routes": [
- {
- "fulfilled_by": {
- "2_DAY_PR": [
- "NJ"
]
}, - "destination_region": {
- "country": "PR",
- "zip_code_region": "All"
}
}
], - "sl_levels_priority": [
- "2_DAY_PR"
], - "location_groups": {
- "NJ": [
- "US_NJ"
]
}, - "zip_code_regions": {
- "All": [
- "*"
]
}
}, - "fulfillment_config_uri": "v0/fulfillment_configuration/revision/13"
}Get routing rules section
Retrieves a section of the current 'Routing Rule V2'. If customer using V1, this endpoint is of no use, and will return the error.
Authorizations:
path Parameters
| section required | string Enum: "routes" "sl_levels_priority" "location_groups" "zip_code_regions" name of the section to retrieve |
Responses
Response samples
- 200
- 400
- 409
- 500
{- "zip_code_regions": {
- "West": [
- "90210",
- "90211",
- "90212",
- "90213"
], - "East": [
- "10001",
- "10002",
- "10003",
- "10004",
- "10005"
], - "South": [
- "33101",
- "33102",
- "33103",
- "33104",
- "33105",
- "33106"
]
}
}