Forum Discussion

PerBonomi's avatar
5 years ago

API call to post message has blank response

Hi folks.

Been using this in an endpoint for many years, but now it returns a blank response, so I can't read if it was successful.

 

<#assign result_post = restadmin("/boards/id/${board_id}/messages/post?message.subject=${msg_subject?url}&message.body=${msg_body?url}")/>

 

If, however, I do a simple 

$.post('/restapi/vc/boards/id/${board_id}/messages/post?message.subject=subject&amp;message.body=body')

then I get a perfectly normal response.

 

Did something change with the v1 API?

6 Replies

  • PerBonomi,

    Where you are requesting this free-marker API to post message?

    Is this you are using in Endpoint or component? then it will always give you blank response, and to print the output from the response you need add code like below to display response example like below for success from API return.

    <#assign result_post = restadmin("/boards/id/${board_id}/messages/post?message.subject=${msg_subject?url}&message.body=${msg_body?url}")/>
    ${result_post.@status}

    so for above your response will be "success".

    And if you same you run with jQuery or other method like curl it will give you full result in the response of console.

  • PerBonomi's avatar
    PerBonomi
    Boss
    5 years ago

    That's the thing. It never gave me a blank result before.

    I have been using this same code for many years and always got results back in the endpoint. I'd get the xml result and the endpoint parsed that to know what to do next.

    My endpoint has this code and I always got results:

    <#assign result_post = restadmin("/boards/id/${board_id}/messages/post?message.subject=${msg_subject?url}&message.body=${msg_body?url}")/>
    		<#assign status_post = result_post.@status/>
    		<#if status_post == "success">
    			<#assign result_post_url = result_post.message.@view_href/>
    			<#assign result_msg_id = result_post.message.id/>

     

    I could parse the result, get the status, get the url of the newly created post, the id. Now, just blank.

    Something changed, and I wish I knew what it was.

    But for argument's sake, let's say I want to do this now.

    My endpoint creates a new post in the community. How do I know what its metadata, id, url, are?

  • PerBonomi,

    Code which you have used is correct.

    and also giving me response when i print to endpoint like below.

    <#assign result_post_url = result_post.message.@view_href/>
    <#assign result_msg_id = result_post.message.id/>
    ${result_post_url}
    ${result_msg_id}

     Its might be something is changed at your endpoint configuration.

    You can log support ticket for this change.

     

     

  • PerBonomi's avatar
    PerBonomi
    Boss
    5 years ago

    Claudius wrote:

    Did you just get upgraded to 20.5 or are you still on 20.3?


    We got upgraded from 19.12 to 20.3. Think that's where the trouble started for us.