0

I want to expose an endpoint in Business Central which can receive HTTP POST/PUT request and save content of that request into Blob, without any validation. I need that so I can receive json or xml data from external custom services.

I'm not sure how to achieve that since both OData and SOAP expect data to be in specific format and trigger data validation before I can even access POST-ed data.

I've been trying to play with Bound/Unbound actions but still can't figure out a way to access the content of the request. WebServiceActionContext is not well documented and I have not idea what I can or can't do with it. More about that: Microsoft documentation, Tutorial.

Any idea how to read content of a HTTP POST/PUT request is appreciated!

1 Answers1

0

You could create a codeunit with a global procedure and then publish that as your web service.

Something like this:

codeunit 50000 MyUnstructuredWebService
{
    procedure PostUnstructuredData(RequestId: Text; RequestContent: BigText);
    begin

    end;
}

Then you can handle the data directly or save it to a BLOB field in a table for later use.

The trick is to use BigText as the datatype for the parameter containing your actual content.

kaspermoerch
  • 16,127
  • 4
  • 44
  • 67