0

I am trying to setup an API in WCF RESTful C# to accept POST form-data from a third party application. Using PHP, the receiving webpage would accept the variable and value through $_POST['TestVariable']. The $_POST['TestVariable'] variable could be used within the page to perform other tasks. As with PHP and $_POST, I would like the WCF RESTful C# API to accept the POST variable, through form-data, and display the POST value. We can perform this task with GET, but we are having issues with POST. I have been using Postman to test my changes with no luck. My question is, is it possible? If it is possible, can you provide a simple example that returns the TestVariable value I can use with Postman?

The code I have been working with is as follows:

public interface IMobileQC
{
    [OperationContract]
    [WebInvoke(Method = "POST", UriTemplate = "GetTag/{PalletID}")]
    ThirdPartyTagMainHeader GetTag(string PalletID);

}
James
  • 236
  • 1
  • 4
  • 13
  • Do [WCF service to accept a post encoded multipart/form-data](https://stackoverflow.com/q/1354749) or [Reading file input from a multipart/form-data POST](https://stackoverflow.com/q/7460088) answer your question? – dbc Mar 30 '23 at 19:11
  • 2
    It's 2023 and WCF has gone the way of ASMX. Just create an API controller. – CodeCaster Mar 30 '23 at 19:28
  • Does [this example](https://stackoverflow.com/questions/9734941/upload-file-from-html-form-multipart-form-data-to-wcf-rest-service-as-a-stream) meet your requirements? – Jiayao Mar 31 '23 at 02:10

0 Answers0