Skip to main content
Version: AMF v5.x.x

Creating an AMF model in memory

AMF can also be used to create APIs in your code, in a fluent and descriptive way.

You can use an AMF WebApi in memory to:

  • Edit an already parsed API
  • Power a visual API designer
  • Create programmatic API tests
  • Debug the WebApi Graph model

Create a WebApi with AMF

The following code example creates a generic "Music Service API" with the following endpoints:

  • /me: Retrieves a user's profile
  • /me/playlists: Retrieves a user's playlists
  • /albums: Retrieves a specific album or a list of albums by their IDs

For the purposes of this API, all responses are returned as strings, but you can further specify requests and responses by defining a schema for an album, playlist, or user.

Code extracted from the examples GitHub repository.