Skip to content

API Endpoints

shimonacarvalho edited this page May 27, 2020 · 22 revisions

About

The Prime API is a RESTful API that enables the Prime contractor to request information about upcoming moves, update the details and status of those moves, and make payment requests. It uses Mutual TLS for authentication procedures.

The API consists of the prime and support endpoints. The prime endpoints will be used in production. The support endpoints provide additional functionality for testing and are not available in production.

The supported production interactions can be seen in the sequence diagram. The endpoint documentation can be viewed using Redoc as described here.

Documentation Using ReDoc

We use ReDoc to provide the most up-to-date documentation for developers. Redoc is a package that generates interactive documentation from the OpenAPI yaml files that describe the Milmove API.

There are a number of ways to use Redoc to view the documentation.

Web links

You can view the documentation in master directly using these links.

Local server

You can also run a local server if you want to point to specific versions of files.

ReDoc CLI uses two yaml files committed to the master branch of the transcom/mymove repo to auto-generate API documentation. This ensures that the docs are in sync with the latest version of the API.

  • prime.yaml - Prime API. Collection of production-ready endpoints.
  • support.yaml - Support API. Collection of endpoints to support development. They are not available in production.

If you have not already checked out the transcom/mymove repo, follow the instructions in Getting Started: Checkout Project.

Important: Make sure to always pull the latest from transcom/mymove before generating docs in case there are any updates.

Install redoc-cli

  • yarn add redoc-cli
  • If you use npx, skip to the next step.

About redoc-cli

ReDoc uses the following command to generate and serve documentation from yaml:

redoc-cli serve [-p PORT] /path/to/file.yaml

  • The default port is 8080.
  • You may optionally pass in a different port. If you want to view the Prime API and Support API docs at the same time, you'll need to pass in a different port for one of your instances.

Generate Docs

  • redoc-cli serve swagger/prime.yaml

  • For support, in a separate terminal window, run:

    • redoc-cli serve -p 8000 swagger/support.yaml
  • or use npx:

    • npx redoc-cli serve swagger/prime.yaml
    • For support, in a separate terminal window, run:
      • npx redoc-cli serve -p 8000 swagger/support.yaml
  • View docs at http://localhost:8080, or if you passed in a specific port, http://localhost:<PORT>

    • Use http://localhost:8000 for the support docs if you have completed all of the above steps.
  • If successful, you should see the API endpoints documentation (copy may be different from screenshot):

Generated API Docs


Testing the API