Skip to main content

Return response as string

Returns the body of the response as a string

Function ReturnResponseAsString(Val Forced = False, Val ExceptionOnError = False) Export

ParameterCLI optionTypeRequiredDescription
Forced-BooleanFalse > The processor object will be returned instead of the response if there were errors in it
ExceptionOnError-BooleanCauses an exception with a log if there were errors during processing
Returns

Arbitrary - The response or the same processing object

Caution

NOCLI: this method is not available in CLI version

1C:Enterprise/OneScript code example
URL = "https://bin.openintegrations.dev";
URL = URL + "/post";

Image = "https://hut.openintegrations.dev/test_data/picture.jpg"; // URL, Path or Binary data

Result = OPI_HTTPRequests.NewRequest()
.Initialize(URL)
.SetBinaryBody(Image)
.ProcessRequest("POST")
.ReturnResponseAsString(); // <---
Result
"{\r\n \"args\": {},\r\n \"data\": \"...\",\r\n \"files\": {},\r\n \"form\": {},\r\n \"headers\": {\r\n \"Accept\": \"*/*\",\r\n \"Accept-Charset\": \"utf-8\",\r\n \"Accept-Encoding\": \"gzip\",\r\n \"Connection\": \"Keep-Alive\",\r\n \"Content-Length\": \"2114023\",\r\n \"Content-Type\": \"application/octet-stream\",\r\n \"Host\": \"bin.openintegrations.dev\",\r\n \"Max-Forwards\": \"10\",\r\n \"User-Agent\": \"1Script v$2.0.1.0\",\r\n \"X-Arr-Log-Id\": \"376569fc-421c-4812-b06f-83f7353bce4b\",\r\n \"X-Arr-Ssl\": \"2048|256|C=BE, O=GlobalSign nv-sa, CN=GlobalSign GCC R6 AlphaSSL CA 2025|CN=*.openintegrations.dev\",\r\n \"X-Forwarded-Host\": \"bin.openintegrations.dev\",\r\n \"X-Original-Url\": \"/post\"\r\n },\r\n \"json\": null,\r\n \"origin\": \"***\",\r\n \"url\": \"https://bin.openintegrations.dev/post\"\r\n}"