Add Parameter
The Add Parameter plugin allows to add parameters to existing accesses in the configuration. The plugin can be used in all booking services, allowing you to dynamically add parameters during the request time.
Additionally, you have the option to replace the value of an existing parameter by adding a parameter with the same key in the query. This allows you to add different parameters to multiple accesses and/or suppliers in the same query.
You don't need to create any files for this plugin. Just specify it in the settings
> plugins
field in your search query.
1. Execute Add Parameter Plugin in Your Query
To use the plugin, add the following field to the settings
node of your request. Note that the add parameter plugin can be executed in search
, quote
, book
, booking
, and cancel
requests. To successfully execute the add parameter plugin, you will need to create the request with the following variables:
step
: "REQUEST_ACCESS"type
: "PRE_STEP"name
: "add_parameterX"parameters
:key
: "parameter_name"value
: "parameter_value"
You may be using the Hotel-X Pull Buyers API in single mode (request for a specific supplier) or in multi mode (request for different suppliers at the same time). Depending on your mode, you might want to use this plugin in different ways:
A. Single mode example
In single mode, for a specific supplier search request, if you need to send an extra parameter "client" with the value "TEST", you could it as follow:
{
"settings": {
"plugins": [
{
"step": "REQUEST_ACCESS",
"pluginsType": [
{
"name": "add_parameter",
"type": "PRE_STEP",
"parameters": [
{
"key": "client",
"value": "TEST"
}
]
}
]
}
]
}
}
B. Multi mode examples
In multi mode, the search request will be replicated to different suppliers, and you may want to add specific parameters to only a specific access. In such cases, you need to send "JSONConfiguration" as the key input and indicate a JSON with the changes you want to apply in the value input. For instance, you want to add a parameter with key 'A' and value '1' for access 123 and parameters 'B' and 'C' with values '2' and '3' respectively for accesses 456 and 789. The following example shows this:
{
"step": "REQUEST_ACCESS",
"pluginsType": [
{
"name": "add_parameterX",
"type": "POST_STEP",
"parameters": [
{
"key": "JSONConfiguration",
"value": "{\"accesses\": [{\"codes\": [\"123\"], \"parameters\": [{\"key\": \"A\", \"value\": \"1\"}]}, {\"codes\": [\"456\", \"789\"], \"parameters\": [{\"key\": \"B\", \"value\": \"2\"}, {\"key\": \"C\", \"value\": \"3\"}]}]}"
}
]
}
]
}
Another case could be adding parameters by supplier. For example, for supplier XXX, you add the parameter with key 'D' and value '4'.
{
"step": "REQUEST_ACCESS",
"pluginsType": [
{
"name": "add_parameterX",
"type": "POST_STEP",
"parameters": [
{
"key": "JSONConfiguration",
"value": "{\"suppliers\": [{\"codes\": [\"XXX\"], \"parameters\": [{\"key\": \"D\", \"value\": \"4\"}]}]}"
}
]
}
]
}