You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-11-27 22:18:36 +02:00
56 lines
1.2 KiB
Plaintext
Vendored
56 lines
1.2 KiB
Plaintext
Vendored
---
|
|
sidebar_position: 7
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
# Add Multipart field
|
|
Adds a form field to the multipart/form-data body
|
|
|
|
|
|
|
|
`Function AddMultipartFormDataField(Val FieldName, Val Value) Export`
|
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|-|-|-|-|-|
|
|
| FieldName | - | String | ✔ | Form field name |
|
|
| Value | - | Arbitrary | ✔ | Field value |
|
|
|
|
|
|
Returns: DataProcessorObject.OPI_HTTPClient - This processor object
|
|
|
|
<br/>
|
|
|
|
:::tip
|
|
The Multipart record must first be initialized using the `StartMultipartBody` function
|
|
:::
|
|
|
|
:::caution
|
|
**NOCLI:** this method is not available in CLI version
|
|
:::
|
|
<br/>
|
|
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
|
URL = "https://httpbin.org";
|
|
URL = URL + "/post";
|
|
|
|
Image = "https://api.athenaeum.digital/test_data/picture.jpg"; // URL, Path or Binary Data
|
|
|
|
Result = OPI_HTTPRequests.NewRequest()
|
|
.Initialize(URL)
|
|
.StartMultipartBody()
|
|
.AddMultipartFormDataFile("file1", "pic.png", Image, "image/png")
|
|
.AddMultipartFormDataField("Field1", "Text") // <---
|
|
.AddMultipartFormDataField("Field2", "10") // <---
|
|
.ProcessRequest("POST")
|
|
.ReturnResponseAsJSONObject();
|
|
```
|
|
|
|
|
|
|
|
|
|
|