I want to send a list of guid to a post method ,as an url parameter and not in a json object :
http://localhost:19116/CustomerManagement.svc/AddServiceContract?s=[44A05EC5-DA1E-4D71-9F23-7194E2996BAE,44A05EC5-DA1E-4D71-9F23-7194E2996BAE]
the template i used is like that
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "AddServiceContract?s={alertGroupId}")]
Guid AddServiceContract(Guid[] alertGroupId,AssetContractAddRequestApi request);
But that return me an error ,is that possible if yes what i am doing wrong ?
CodePudding user response:
After searching for a solution , i found that there's no standard as it's described here
so i just used a parameter as string (string alertGroupId) ? and from postman i used this call :
http://localhost:19116/CustomerManagement.svc/AddServiceContract?alertGroupId=5B7DD5F5-79A2-405E-A824-0B7201018C14&alertGroupId=1717B90C-348B-4D85-9608-69288180ED96&alertGroupId=44A05EC5-DA1E-4D71-9F23-7194E2996BAE
in csharp, you get a comma separated string alertGroupId , that you can split