Menu

Carriage return in API calls

2024-08-16
2024-08-19
  • mls.nicolas

    mls.nicolas - 2024-08-16

    Hi,

    I'm creating new UserRequest in iTop through the API. The description of the Request contains carriage returns (\n).
    Once the request is created and I open it in iTop, the description does not contain any carriage return, everything is on one line.

    Is there a way to keep them ? Do I need a specific encoding or something like it ?
    Thanks!

    Nicolas

     
  • mls.nicolas

    mls.nicolas - 2024-08-16

    My api calls with line breaks are in fact formatted as \r\n.

     
  • Guillaume Lajarige

    Hello Nicolas,

    I don't recall exactly how it works, but did you try sending the description as HTML? (using <br/> for line returns)

    Hope it helps,
    Guillaume

     
  • mls.nicolas

    mls.nicolas - 2024-08-19

    Hi Guillaume,

    Thank you for your help !
    While doing str_replace("\r\n", "<br/>", $description) is a bit dirty, it works...
    If it works, it works ;-)
    Thanks again !

     

    Last edit: mls.nicolas 2024-08-19

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.