Questions tagged [webapi]

Questions related to web browser's Web APIs specification. Web APIs is a set of numerous different APIs related to programmatically using web browser with your JavaScript code. For example the visual web page rendered is represented as and controlled by Document Object Model (DOM), which itself is a Web API. Or when using console.debug() function to log messages to the browser's console, you are using Console API.

Questions related to web browser's Web APIs specification.

Web APIs is a set of numerous different APIs related to programmatically controlling the functions of a web page that is run in the web browser with JavaScript code.

For example the visual web page rendered is represented as and controlled by Document Object Model (DOM), which itself is a Web API. Or when using console.debug() function to log messages to the browser's console, you are using Console API.

If you are new to Web APIs, you can read: Introduction to web APIs

1984 questions
4
votes
1 answer

How to use DecompressionStream to decompress a gzip file using JavaScript in Browser?

All major browsers now support the DecompressionStream API, but I can't figure out how to use it with fetch() to decompress a gzip file in browser. The following code works with a base64 string: const decompress = async (url) => { const ds = new…
Jay Wang
  • 2,650
  • 4
  • 25
  • 51
4
votes
0 answers

Custom Controller Factory in ASP.NET Core Web Api

I'm working on a simple WebApi project and I've defined an abstract CRUD controller that allows me to share the same logic for GET/POST/PUT/DELETE requests. However, I still obviously need to create concrete controller classes that implement the…
canta2899
  • 394
  • 1
  • 7
4
votes
2 answers

ASP.NET Core WebApi Retrieve Last n Records

I have put together a GET request that returns the last n (5) records on WebApi. Simply creating a call to get the entire list back async, then count the last five items, add them to a List of the custom type, that is Application in this case, then…
4
votes
1 answer

How to support OneOf(OpenApi) in asp.net core WebApi

Is there any way I can support oneOf in asp.net core webapi. Can I support two different schemas in the request body? https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/#oneof
Dinesh
  • 97
  • 9
4
votes
2 answers

Get git commit id for C# .Net Core Application

I'm working for a .NET Core web api application. My requirement is to show repository's (Bitbucket) latest local git commit id of in the home controller. Can someone help me on this please?
Gopinath D
  • 135
  • 4
  • 7
4
votes
2 answers

Why using HttpClient in a using block IS WRONG in WebApi context?

So, the question is why the usage of HttpClient in using block is WRONG, BUT in WebApi context? I've been reading this article Don't Block on Async Code. In it we have the following example: public static async Task GetJsonAsync(Uri uri) { …
Rostech
  • 322
  • 1
  • 11
4
votes
0 answers

ERR_HTTP2_PROTOCOL_ERROR in the network tab when using Chrome Dev Tools

I've got a website hosted on IIS, http2 enabled, when using Chrome Dev Tools the site fails to load. Every network request comes back with ERR_HTTP2_PROTOCOL_ERROR. If I close Dev Tools and refresh the site everything loads as you would…
4
votes
0 answers

Is it possible to make an Android Instant app with bluetooth through web api

iOS App Clips supports Bluetooth, but Android Instant apps do not. Is it possible to make an Android Instant app with a web view that uses the Bluetooth web API? This is more a theoretical question and out of curiosity than if it is a good idea. So…
4
votes
2 answers

How do you pass a derived JObject class in the body of a Web Api

If I have the class public class TestMe : JObject { } How do I consume it within an API method? public async Task UpdateMe(int accountId, [FromBody] TestMe sometest) { Console.WriteLine(sometest); ... When I try posting…
Post Impatica
  • 14,999
  • 9
  • 67
  • 78
4
votes
2 answers

What is the difference between web api and interface?

The following link refers to the MDN page where a host of Web APIs and interfaces are listed: https://developer.mozilla.org/en-US/docs/Web/API However, there is no explanation of what are the main differences between Web API and interface. I also…
Linas M.
  • 312
  • 1
  • 3
  • 17
4
votes
3 answers

The request matched multiple endpoints on .NET Core

I use OpenAPI (Swagger) in a .NET Core project and when using multiple methods that have similar get requests, I encounter "Microsoft.AspNetCore.Routing.Matching.AmbiguousMatchException: The request matched multiple endpoints." error during runtime.…
Jack
  • 1
  • 21
  • 118
  • 236
4
votes
2 answers

“Illegal characters in path.” only when viewing from mobile browser

I'm using a traditional WebAPI controller: [Route("api/results/{query}")] [AcceptVerbs("GET")] public HttpResponseMessage GetQueryResults(string query) { var userAgent = Request.Headers.UserAgent; var result =…
BLAZORLOVER
  • 1,971
  • 2
  • 17
  • 27
4
votes
1 answer

Return 401 for invalid token even if method is marked AllowAnonymous

Using .Net framework, Web Api. I have the [Authorize] attribute on my controller and [AllowAnonymous] on some endpoints. I have several endpoints which allows anonymous, but return different (more) data if a user is authenticated. If a user has an…
mendel
  • 1,511
  • 1
  • 16
  • 20
4
votes
0 answers

what is Logical Display Surface in Screen Capture API of browser?

I'm wondering that what is Logical Display Surface actually ? In MDN docs: A logical display surface is one which is in part or completely obscured, either by being overlapped by another object to some extent, or by being entirely hidden or…
Sake
  • 96
  • 5
4
votes
0 answers

System.Security.Cryptography.CryptographicException

When I try to encrypt & decrypt sample text in my WebAPI project the message encrypt successfully but in decryption it dose not work . I have already set in my startup.cs => services.AddDataProtection(); Here is error…
Mousavi
  • 95
  • 7