locked
what are the clinets for web api RRS feed

  • Question

  • User87195929 posted

    Hi

    i New to Web api in asp.net. i heard the most networking devices are clinets  for web Api in asp.net

    if  mobile device  is one of the clients and make the use of browser for calling the Web Api service,

    But in most of networking Device how they call web Api  services with out Browser. please Explain Me this

    Thanks  And regards

    Siddu

    Wednesday, January 24, 2018 1:11 PM

All replies

  • User753101303 posted

    Hi,

    A browser doesn't have anything special. It's just an app that will call functions provided by the underlying OS to send http requests. For example with an ASP.NET, Desktop or Xamarin application, you'll use something like  https://docs.microsoft.com/en-us/aspnet/web-api/overview/advanced/calling-a-web-api-from-a-net-client to send http request to a web api service.

    With Objective-C, Java etc... you'll find as well functions to programmatically send http requests (taking advantage of the underlying OS support for that) from any kind of app you could write.

    Wednesday, January 24, 2018 1:36 PM
  • User-37275327 posted

    This is where you can find the required information.

    • https://www.asp.net/web-api
    Wednesday, January 24, 2018 5:14 PM
  • User-1838255255 posted

    Hi siddangoud,

    About how to call webapi, only need send a http request to call web api actually, the web application is not the only method to send http request, the web application need run in the browser, so you think browser could call web api. Actually, you could send this request in console application, windows form application etc. 

    Also you could refer to this tutorial:

    Call a Web API From a .NET Client (C#): 

    https://docs.microsoft.com/en-us/aspnet/web-api/overview/advanced/calling-a-web-api-from-a-net-client 

    Create A Web API And Call It Using A Desktop Client Application: 

    http://www.c-sharpcorner.com/article/create-a-web-api-and-call-it-using-a-desktop-client-application/ 

    Best Regards,

    Eric Du 

    Thursday, January 25, 2018 8:35 AM
  • User-474980206 posted

    most mobile device has a network api. you use this to call a web api. on IOS its something like:

    // Set the URL the request is being made to.
    let request = URLRequest(url: NSURL(string: "https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY")! as URL)
    do {
        // Perform the request
        var response: AutoreleasingUnsafeMutablePointer<URLResponse?>? = nil
        let data = try NSURLConnection.sendSynchronousRequest(request, returning: response)
     
        // Convert the data to JSON
        let jsonSerialized = try JSONSerialization.jsonObject(with: data, options: []) as? [String : Any]
     
        if let json = jsonSerialized, let url = json["url"], let explanation = json["explanation"] {
            print(url)
            print(explanation)
        }
    }


     

    Saturday, January 27, 2018 12:36 AM