Add value
Adds a value to the Form or Json body array
- Parameters
- Advanced call ?
Function AddValue(Val FieldKey, Val ElementValue, Val ValeType = Undefined) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| FieldKey | --key | String | ✔ | Array field key. Empty for insertion at the root of the body |
| ElementValue | --value | Arbitrary | ✔ | Value to be added to the end of the array |
| ValeType | --type | String | ✖ | Type name for automatic conversion attempt |
Returns
DataProcessorObject.OPI_HTTPClient - This processor object
| Parameter | Description |
|---|---|
| dontwait | Creates a background job and returns its data (for 1C and OneScript only) |
1C:Enterprise/OneScript code example
URL = "https://bin.openintegrations.dev";
URL = URL + "/post";
ExpectedArray = New Array;
ExpectedArray.Add("A");
ExpectedArray.Add("B");
Result = OPI_HTTPRequests.NewRequest()
.Initialize(URL)
.InitializeJsonBody()
.InsertBodyField("Field1", 10)
.InsertBodyField("Field3", New Array)
.AddValue("Field3", "A") // <---
.AddValue("Field3", "B")
.ProcessRequest("POST")
.ReturnResponseAsJSONObject();
Result
{
"args": {},
"data": "{\r\n \"Field1\": 10,\r\n \"Field3\": [\r\n \"A\",\r\n \"B\"\r\n ]\r\n}",
"files": {},
"form": {},
"headers": {
"Accept": "*/*",
"Accept-Charset": "utf-8",
"Accept-Encoding": "gzip",
"Connection": "Keep-Alive",
"Content-Length": "53",
"Content-Type": "application/json; charset=utf-8",
"Host": "bin.openintegrations.dev",
"Max-Forwards": "10",
"User-Agent": "1Script v$2.0.1.0",
"X-Arr-Log-Id": "3935f126-8ffb-485f-95b9-9b70c3d91d50",
"X-Arr-Ssl": "2048|256|C=BE, O=GlobalSign nv-sa, CN=GlobalSign GCC R6 AlphaSSL CA 2025|CN=*.openintegrations.dev",
"X-Forwarded-Host": "bin.openintegrations.dev",
"X-Original-Url": "***"
},
"json": {
"Field1": 10,
"Field3": [
"A",
"B"
]
},
"origin": "***",
"url": "https://bin.openintegrations.dev/post"
}