Insert body field
Inserts a new field into the Form or Json body collection
- Parameters
- Advanced call ?
Function InsertBodyField(Val FieldKey, Val FieldValue, Val ValeType = Undefined) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| FieldKey | - | String | ✔ | Key of the inserted field |
| FieldValue | - | Arbitrary | ✔ | Field value |
| ValeType | - | String | ✖ | Type name for automatic conversion attempt |
Returns
DataProcessorObject.OPI_HTTPClient - This processor object
This method has no additional advanced call parameters.
Caution
NOCLI: this method is not available in CLI version
1C:Enterprise/OneScript code example
URL = "https://bin.openintegrations.dev";
URL = URL + "/post";
Result = OPI_HTTPRequests.NewRequest()
.Initialize(URL)
.InitializeJsonBody()
.InsertBodyField("Field1", 10) // <---
.InsertBodyField("Field2", "Text")
.ProcessRequest("POST")
.ReturnResponseAsJSONObject();
Result
{
"args": {},
"data": "{\r\n \"Field1\": 10,\r\n \"Field2\": \"Text\"\r\n}",
"files": {},
"form": {},
"headers": {
"Accept": "*/*",
"Accept-Charset": "utf-8",
"Accept-Encoding": "gzip",
"Connection": "Keep-Alive",
"Content-Length": "39",
"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": "6512fc9e-b5c0-428f-80f2-ba15ed798452",
"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,
"Field2": "Text"
},
"origin": "***",
"url": "https://bin.openintegrations.dev/post"
}