Skip to main content

Today we released version 2.0 of the Data Exchange library, containing the initial release of the support in AIMMS for generating client code to call APIs directly from within your model. The API client code generator will generate an API client directly from the OpenAPI specification of the service you want to connect to.

While the Data Exchange library already had support for making HTTP requests and reading/writing JSON or XML request or response bodies, using this basic functionality to actually call an API was quite laborious and error-prone. The new API client code generator inside the Data Exchange library will tremendously ease the integration of third party APIs within your AIMMS model.

For a given OpenAPI service specification, the generator will

  • create a runtime library with collections of identifiers that can hold data for any JSON schema encountered in the OpenAPI specification file for describing request and response bodies. The library also offers support for generating this directly from a JSON schema file.
  • create DEX mappings to map these collections of identifiers onto corresponding JSON or XML documents to create request bodies, or parse response bodies
  • create procedures to make API calls to every operation defined in the OpenAPI specification, taking care of path and query parameter handling, handling of headers and cookies, generation of request bodies from, or parsing the results into, the identifiers generated in the runtime library

The generated code will support security schemes either using API keys, or using the OAuth2 authorization code or client credentials flows.

All API calls will be executed in a completely asynchronous fashion, allowing multiple API calls to be made in parallel, For simple uses, the generator also allows generating a more simplified synchronous variant.

At this point, the generator does not yet offer support for multi-part and/or binary request and response bodies. 

There is now a How-to with a project example for this functionality...check it out!

 


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator