Saturday, December 1, 2018

Postman testings on WEB API

1) Get - WEB API method signature


    Get - Postman Call


2) Post WEB API method signature


      Post - Postman Call


  • Body part of the call



  • Header and Result




3) Post - Multipart request, including Image file




  • WEB API method signature


Postman call -  Multipart, including Image file


Capturing the HTTP multi-part requests data within the WEB API method:

                if (HttpContext.Current.Request.Params["FirstName"] != null)
                {
                    newUser.FirstName = HttpContext.Current.Request.Params["FirstName"];
                }

Capturing the image file sent:

var imageFile = HttpContext.Current.Request.Files.Count > 0 ? HttpContext.Current.Request.Files[0] : null;


No comments:

Post a Comment