Options

Modify Response for oData page webservice

jimmyfjimmyf Member Posts: 103
In BC version 16 I have published an API page as a webservice and after inserting data successfully I would like to include specific data in the response that can be used by the application calling the webservice.

Is this possible and if so how do I do this?

Thank You

Answers

  • Options
    SanderDkSanderDk Member Posts: 497
    You can add a field to the API page and fill you specific data in that field, then the webservice client can read what you have added to the field?
    For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.
  • Options
    jimmyfjimmyf Member Posts: 103
    Thanks for your reply.
    From an external application we are inserting data into the table behind the api page.
    Are you suggesting that I create another field in the table that contains the data I want to send back in the response and populate that field onafterinsert of the data?
    Will that field and value exist in the response?
  • Options
    SanderDkSanderDk Member Posts: 497
    I would not add the data to the table behinde the API page, but I would only create a variable on the page and insert data into that field, OnNewRec trigger ex
    For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.
  • Options
    jimmyfjimmyf Member Posts: 103
    Ok. And will this variable be visible in the json response?
  • Options
    SanderDkSanderDk Member Posts: 497
    yes.
    For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.
  • Options
    jimmyfjimmyf Member Posts: 103
    Hi Sorry for taking so long to respond, but unfortunately this did not work.
    I created a global variable on the API page called responseMessage, and populated it as you suggested and on a successful Post the response did not include this variable.
    Do I need to declare the variable in a particular way?
Sign In or Register to comment.