-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Let's walk through setting up your environment to make your first API call to the Prime API.
- Install dependencies
- Check out the MilMove project
- Run the Docker container
- Use the CLI Prime API Client
Required Libraries:
Homebrew is the package manager we use to install the rest of the dependencies.
- Use the following command to install Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Note: You'll be prompted to install Xcode Command Line Tools if you don't have them already.
The backend server and client tool are written in Golang. Please read through the steps even if you already use Go, since there are required changes to your PATH.
brew install go
-
Notes:
- Current Go version: go1.14 (released 2020/02/25)
- We normally use the latest version of Go unless there's a known conflict (which will be announced by the team) or if we're in the time period just after a new version has been released.
- If you have previously modified your PATH to point to a specific version of go, make sure to remove that. This would be either in your
.bash_profile
or.bashrc
, and might look something likePATH=$PATH:/usr/local/opt/go@1.12/bin
.
- Add the following to your
.bash_profile
:export GOPATH=${GOPATH:-$(go env GOPATH)}
export PATH=$(go env GOPATH)/bin:$PATH
- Apply the changes to your shell:
source ~/.bash_profile
We use Docker to automate much of the process of setting up your environment, creating databases, and running the server you need to access the Prime API.
- Install the Docker desktop app
- Download the desktop app: https://www.docker.com/products/docker-desktop
- Once downloaded, install and run.
- Or install Docker via Homebrew
brew cask install docker
open /Applications/Docker.app
- The Mac OS desktop app already includes Compose
- For Windows, see Docker's installation instructions here: https://docs.docker.com/compose/install/
To ensure that the local environment variables are set up correctly, we use direnv to load them when you cd
into the directory.
brew install direnv
- For direnv to work properly, it needs to be hooked into the shell.
- Once the hook is configured, restart your shell for direnv to be activated.
Add the following line at the end of your ~/.bash_profile
:
eval "$(direnv hook bash)"
Make sure it appears even after rvm, git-prompt and other shell extensions that manipulate the prompt.
Add the following line at the end of the ~/.zshrc file:
eval "$(direnv hook zsh)"
jq is a command-line JSON processor used with the CLI Prime API Client tool.
brew install jq
Yarn is a dependency manager used by the Dockerfile.
brew install yarn
You can checkout this repository by running git clone git@github.com:transcom/mymove.git
. Please check out the code in a directory like ~/Projects/mymove
and NOT in your $GOPATH. As an example:
mkdir -p ~/Projects
git clone git@github.com:transcom/mymove.git
cd mymove
-
Copy
.envrc.local.template
to.envrc.local
if you do not already have.envrc.local
.cp .envrc.local.template .envrc.local
-
This template contains the environment variables needed to start using the application, except one. You need to generate your local secret key using these instructions.
Make sure you've installed the dependencies before proceeding. From the /mymove
directory, run:
make run_prime_docker
Wait for the script to finish running. When finished, you should see [#TODO--get expected view/text].
To verify your setup is working correctly, you can quickly test the API using the prime-api-client
CLI tool. For this example, we'll GET /move-task-orders
, which returns an array of all move task orders.
Run:
go run ./cmd/prime-api-client --insecure fetch-mto-updates
You should see a response similar to:
[
{
"createdAt": "2020-03-23",
"id": "c66e2e16-4b3c-467b-a3a8-c80e46135dd2",
"isAvailableToPrime": true,
"isCanceled": false,
"moveOrder": {
"confirmationNumber": "GBQP4Q",
"customer": {
"branch": "COAST_GUARD",
"currentAddress": {
"city": "",
"id": "00000000-0000-0000-0000-000000000000",
"postalCode": "",
"state": "",
"streetAddress1": ""
},
...
},
...
]
Congrats! You've made your first call to the Prime API.
When you're finished testing, remember to shut down the server:
make docker_compose_down
- Learn how to use the Prime API Client: Using the Prime API Client
- Learn more about available endpoints: API Endpoints
- Auto-generate and develop your own client: Sample Java Client