Re: Roundup REST API

SCHLEMMER Norbert <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <[email protected]>
Hello Ralf
Thanks for your quick reply, works perfect!
Br
Norbert

-----Ursprüngliche Nachricht-----
Von: Ralf Schlatterbeck [mailto:[email protected]] 
Gesendet: Donnerstag, 24. Juni 2021 09:44
An: [email protected]
Betreff: Re: [Roundup-users] Roundup REST API

*EXTERNAL source*


On Thu, Jun 24, 2021 at 07:05:21AM +0000, SCHLEMMER Norbert wrote:
> Hello
> who can we send a message content field with CR and LF chars using the REST API ?
> The content of "content" starts with CR / LF :
>
> JSON Object:
> { "content":"
> logVersions - OS name: Windows Server 2012 R2 Standard logVersions - 
> OS version: 6.3 build 9600 logVersions - CPU architecture: amd64 ...
> logVersions - Process id: 2152
> logVersions - Session id: 0", "author":"vast-platform", 
> "date":"2021-06-24.08:31:27" }
>
> the request terminates with:
> 400 Bad Request, {
>     "error": {
>         "status": 400,
>         "msg": "No properties found."
>     }
> }

Usually you want to quote the characters in question, python example that produces valid json for strings with embedded newline/carriage
returns:

>>> import json
>>> d = dict (a = 'text\nwith newline\r\nand carriage-return newline')
>>> json.dumps(d)
'{"a": "text\\nwith newline\\r\\nand carriage-return newline"}'
>>> print (json.dumps(d))
{"a": "text\nwith newline\r\nand carriage-return newline"}

It should be possible to use this.

Note that if you have binary contents that you want to attach (e.g. as contents of a file in roundup) you cannot do this in JSON because JSON can only encode valid UTF-8. In that case you can still create the object but you would not use json encoding but a different mechanism:

For howto on this see https://issues.roundup-tracker.org/issue2551067 in particular https://issues.roundup-tracker.org/msg6747

Ralf
--
Dr. Ralf Schlatterbeck                  Tel:   +43/2243/26465-16
Open Source Consulting                  www:   www.runtux.com
Reichergasse 131, A-3411 Weidling       email: [email protected]


_______________________________________________
Roundup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/roundup-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.