🏠 👨‍🦲

Jsonbin.io and Asp.net Core

Fri Apr 21 2023

I’ve started using jsonbin to mock some simple api calls. I’m impressed with the simplicity and the possibility to validate bins to a JSON schema.

  1. Ask chatgpt to write a example JSON given the schema that I provide.
  2. Add a bin using their rest endpoint
curl -v  -H "Content-Type: application/json"   -H "X-Master-key: <YOUR_API_KEY>"   --request POST   --data '{"sample": "Hello World"}'     https://api.jsonbin.io/v3/b
  1. In your ASP.net Core app add the http client and specify X-Bin-Meta: false to skip the extra wrapper.
.AddHttpClient<IMyHttpClient, MyHttpClient>(options =>
{
    options.BaseAddress = new Uri("https://api.jsonbin.io/");
    options.DefaultRequestHeaders.Add("X-Bin-Meta", new [] { "false" });
});