Post request with parameters
Answers
-
zohaibu95@hotmail.com wrote: »You can do POST request by using my this code:
Parameters
Local VariablesCallRESTWebService(BaseUrl : Text;Method : Text;RestMethod : Text;VAR HttpContent : DotNet "System.Net.Http.HttpContent";VAR HttpResponseMessage : DotNet "System.Net.Http.HttpResponseMessage") HttpClient := HttpClient.HttpClient(); HttpClient.BaseAddress := Uri.Uri(BaseUrl); CASE RestMethod OF 'GET': HttpResponseMessage := HttpClient.GetAsync(Method).Result; 'POST': HttpResponseMessage := HttpClient.PostAsync(Method,HttpContent).Result; 'PUT': HttpResponseMessage := HttpClient.PutAsync(Method,HttpContent).Result; 'DELETE': HttpResponseMessage := HttpClient.DeleteAsync(Method).Result; END;
Explanation of the parameters
BaseUrl – the first part of the url that is being called, e.g.: http://www.google.com/
Method – the resource on the web service, in other words, the second part of the url, e.g. somecoolapi/parameter?option=value
RestMethod – one of the request verbs, either GET, POST, PUT or DELETE
HttpContent – the content to be sent with the POST or PUT command
HttpResponseMessage – the response message containing the status code and the response body. This parameter is ByVar because the calling code needs to handle the specific response itself. That’s not part of the generic pattern.
You have to put your data in HttpContent because you are using POST method. This is the correct way of sending parameters via post.
Como ingreso mi blob en un http content?0 -
Thank you, I'll try this solution and will let you know about it's result.-1
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions