Line breaks are not converted to line break codes when entering multiple lines
complete
Takuya Matsuda
With multiple text inputs turned on, it is displayed on the action execution screen that the actual transmitted value becomes the default line break code
\n
, but when executed, it becomes Malformed JSON in request body.It seems that a value that looks like a space is transmitted in experimantal > args of the data before processing due to customizing the results, and I don't think this has been replaced by a line break code.
Source: HTTP API
parameters:
- name: detail
- Advanced settings: text (required), ON for entering multiple lines, OFF for specifying line breaks
Method: POST
Request type: JSON
Request body:
{
“name”: “{{name}}”,
“companyId”: “{{companyId}}”,
“detail”: “{{detail}}”,
}
※It's a memory that didn't work without putting double quotes before and after the variables in the request body, but as far as I can see from the documentation, it seems unnecessary. However, the behavior did not change even without double quotes.
ベースマキナサポート担当
marked this post as
complete
ベースマキナサポート担当
A description of embedding line breaks into JSON strings in HTTP API actions has been added to the documentation.
For this ticket, I'm moving the Board from Bugs to Questions.
ベースマキナサポート担当
Thank you for contacting us.
Entering action parameter values for the HTTP API request body is basically a simple substitution.
Therefore, if a line break character is not specified in the
text
type parameter, the behavior is as follows.Request Body
{
“detail”: “{{detail}}”,
}
Details parameter inputs
line 1
line 2
Request body to be submitted
{
“detail”: “line 1
line 2”,
}
Such JSON is invalid, so when entering multi-line text to JSON, it is necessary to explicitly specify “\\n” (2
\
) in the “specify line break characters” option.Request body sent when the newline character is set to “\\n”
{
“detail”: “line 1\nline 2”,
}
Alternatively, if you use a parameter called a JSON value, the value is automatically encoded into a form that can be expressed as JSON, so setting “value type: JSON value” and “JSON value type: text” for the parameters is also an option (a screenshot of an example setting in this case is attached).
When using JSON values, double quotes are also automatically assigned, so explicit specification is unnecessary.
If you use a normal text type that is not a JSON value, it will be as described above, but since it will be a
simple replacement
, an explicit double quote description is required.Regarding this, the screenshot on the HTTP API action documentation was misleading, so we will correct it later.
Takuya Matsuda
ベースマキナサポート担当
It worked!
An example of using a JSON value is that the user has to manually type a JSON string on the action execution screen...
If that's a little bit unrealistic as an operation, I'll use\\n.
Thank you so much for your quick response!
this matter closed? and it's fine!
ベースマキナサポート担当
Even in the case of JSON values, there is almost no change in usage from text type parameters, just enable multi-line input.
In the case of JSON values, the content is automatically escaped, so there is no need to explicitly specify line break characters. Also,
"
entered in the text is automatically escaped. For these reasons, it seems that there are many cases where JSON values are more appropriate for embedding within JSON text.I'm afraid there are so many options, but I would appreciate it if those who feel that it's easy to use can use it.