0

Send message with multi line

Hi

I can use API to send single line message by C# . But if the message contains newline character \r\n, i will get the 400 bad request error. Anyone know how to send multiline

the postdata is simple string postdata = "{\"message\" : \"" + msg + "\"}";


Thanks

by
2 Replies
  • QUOTE (Minh @ May 19 2011, 02:02 AM) <{POST_SNAPBACK}>
    Hi

    I can use API to send single line message by C# . But if the message contains newline character \r\n, i will get the 400 bad request error. Anyone know how to send multiline

    the postdata is simple string postdata = "{\"message\" : \"" + msg + "\"}";


    Thanks


    You need to escape the '\', the following postdata works:

    "{\"message\":\"this is a\\r\\n test\"}"

    Thomas
    0
  • QUOTE (mf_account31 @ May 19 2011, 04:59 AM) <{POST_SNAPBACK}>
    You need to escape the '\', the following postdata works:

    "{\"message\":\"this is a\\r\\n test\"}"

    Thomas


    And to avoid this kind of problems, I use the Newtonsoft.Json library which generates postdata for me (and escapes everything which needs to be escaped ;)Thomas
    0

Recent Posts

in Messenger IM SDK