top of page

What Is API Generation?



Introduction


API Generation empowers developers to accelerate the development process of setting up a new API significantly. Whether you're creating an API for the first time or you're a seasoned veteran, crafting an API is more straightforward with the tools provided by Perigee.


API Generation refers to the creation of an API from a source document, such as Postman, or directly in code using the fluent syntax, without the in-depth knowledge required to configure a new API from scratch. It might seem too good to be true...

Did you know you could save hundreds of hours by generating an API from a JSON source?

Benefits of API Generation


When contemplating your next API project, here are some points to consider:


Mocking


Mocking is the procedure of emulating a production API and creating a "shadow copy" for testing purposes. This ensures tests are conducted without the repercussions of calling the actual API. Such capability grants developers complete control over integrations. They can alter API responses, introduce delays, and disable parts of the API, facilitating better integration development from the outset.


A New API?


Embarking on a new API for testing or production? Feed the generator a set of JSON documents and gain a substantial advantage in your new venture. Sidestep the tedious hours spent on configuring authorization, settings, or Swagger examples—let the code handle it!


Typo Free


Eliminate concerns over model typos or overlooked code. We generate everything based on a model registry that ensures the output is pristine C# code.


Time Savings


In our demo, we replicated the DropBox API, resulting in approximately 35,000 lines of code, encompassing:


  • Class Models

  • Documentation

  • Controllers and Actions

  • Swagger Samples

  • Comments

  • Authorization


Ponder over this: How long would it take your developers to rewrite 35,000 lines of code—error-free, typo-free, and meticulously documented? A lot of caffeine might be needed to answer that!

AI Power


Curious about how OpenAI's ChatGPT API hinting operates? Here's an insight:


Consider an API method you've set up named EchoMessage. The model defined for this is a class named Echo that comprises a message string.


Your AI hint suggests: "Take my echo message method and return a JSON object that sends the user's message back to them."


In response, the API Generator composes a specific message for GPT, containing your input/output models and the organized method, providing GPT with the complete context to fulfill your request. It appears like:


public class Echo { public string message {get; set; } }

[HttpPost]
public IActionResult EchoMessage([FromBody] Echo request) {
    //{Take my echo message method and return a json object that returns the users message back to them}
}

GPT could suggest the following improved code (this is an actual response from GPT!):


[HttpPost("EchoMessage")]
public IActionResult EchoMessage([FromBody] Echo request)
{
    if (request == null)
    {
        return BadRequest("Request body is null");
    }
            
    return Ok(new { echoedMessage = request.message });
}

Impressive, isn't it?



 

Email Icon

Follow all the exciting developments of the Perigee Revolution by joining our Perigee Email List today! Or simply email us at info@perigee.software



Youtube icon

Watch the latest disrupting videos at Perigee Software - YouTube



twitter icon

Tweet at us at @PerigeeNinja




documentation icon

Get full documentation with ready-to-run examples at Perigee Documentation




Facebook icon

Like us on Facebook at Perigee Facebook Page

715 views0 comments

Commentaires


bottom of page