Ask or search…
K
Links

API Builder

APIBuilder

This static class enables users to create an API specification using both custom specifications as well as specifications derived from Postman integration. Most notably, it provides a way to fully generate a complete Web API given an APISpecification.

From

This method allows users to manually build an API Specification using a fluent syntax.
You can easily add endpoints after declaring the specification like so:

Example:

//Declare spec
var spec = APIBuilder.From("ProjectName", AuthorizationType.Bearer, true, true);
//Add as many endpoints, in this example, an echo endpoint
spec.AddEndpoints(
APIGeneration.Endpoint.From(spec, "Echo", "/echo", APIGeneration.Method.GET)
.WithRequestJSON(@"{""echo"": ""message""}")
.WithAIAssistance("Echo the message back to the use in json"));

FromPostman

This method allows users to build an API Specification from Postman. This is useful for integrating existing Postman collections into new or existing projects.
If your collection contains {{environment variables}}, please supply the environment.json as well as the collection.json.

Example:

APIBuilder.FromPostman("ProjectName", "PostmanCollection.json", "env.json");

GenerateAPI

This method generates a full web API given an APISpecification. It requires the specification object, the project path, as well as optional parameters for IIS, HTTP and HTTPS Ports, additional installs, additional App Settings, a GPT Token and Model for generative AI, and boolean flags for generating Controller and Method summaries.

Example:

APIBuilder.GenerateAPI(spec, "ProjectPath", 60978, 7181, 7182, additionalInstalls, additionalAppSettings, "GPTToken", "gpt-4", true, false);