Skip to main content
Solved

http connector content using CR problem

  • January 6, 2022
  • 1 reply
  • 84 views

Hugo Nienhuis
Superhero
Forum|alt.badge.img+12

I am trying to connect to an outside API using the HTTP-connector. I need to call different procedures, using different content-types (application/json, multipart/form-date). I want to build the process variable ‘content’ within a template and feed it to the http-connector. This fails.

When I select the content from a table-field with datatype nvarchar(4000) and multiline control it works fine. I can select the content from the column and feed it to the http connector. It also works when  I use a taskparameter to paste the content into the process variable.

So far I figured out that it has something to do with the CR / linefeed. But when I simply remove all CR's, this still won't work. Since I need to compose the content from some static text and a few variables (pdf-data for example) I do need the template.

Example of what I am trying to build (which works fine when using the task-parameter):

 

Content-type:

multipart/form-data;boundary=abcde12345

Content:

--abcde12345
Content-Disposition: form-data; name="payload"

{
  "name": "test.pdf",
  "extract": true,
  "extractionTypes": [
    "TEXT_TAGS"
  ]
}


--abcde12345
Content-Disposition: form-data; name="file"
Content-Type: application/pdf

(pdf-data)

--abcde12345--

 

Does anybody know how to build this content within a template?

Best answer by Hugo Nienhuis

Prefix Unicode character string constants with the letter N. Without the N prefix, the string is converted to the default code page of the database.

Works, problem solverd.

This topic has been closed for replies.

1 reply

Hugo Nienhuis
Superhero
Forum|alt.badge.img+12
  • Author
  • Superhero
  • Answer
  • January 7, 2022

Prefix Unicode character string constants with the letter N. Without the N prefix, the string is converted to the default code page of the database.

Works, problem solverd.