Link a collection to disk#
Mirror requests to files that follow your edits both ways, so they can live in version control.
A link between a collection and a folder mirrors the collection to files on disk and keeps the two in step. Every request becomes a file and every folder a directory. Edits flow both ways: change a request in the app and the file updates. Change the file in your editor, or switch branch in version control, and the app follows. This is how you keep API requests in version control alongside the code they exercise.
Link a collection to a folder#
Open the menu on a collection in the Collections tree and choose Link to folder, then choose a directory. What happens next depends on the folder:
- An empty folder. API Client fills it with the collection's files.
- A folder that already holds a linked collection. API Client reads it back in, and the version on disk wins.
From then on, API Client watches the folder. It writes out your in-app edits, and it reads back outside changes. The same menu now shows Unlink folder. That action stops the sync and leaves the files where they are.
What ends up on disk#
The layout reads well in review and commits cleanly. Each request is its own file, and the folders in your collection become directories. API Client also writes out flows and environments. It adds an ignore rule, so machine-local files stay out of version control by default.
While a collection is linked, the sidebar shows a small badge beside its name. The badge tells you whether the folder is in sync, a write is in progress, or something has gone wrong.
Secrets stay out of the shared files#
API Client strips two things from the files on disk: the values you marked secret, and the credential fields of an auth method. The files keep the variable names and the fact that a value is secret. They do not keep the value itself. The real values stay only in your local, encrypted store.
This keeps a linked folder safe to commit and push. A colleague who clones it gets the requests and the variable names, then fills in the secret values on their own machine. See Variables for how to mark a variable secret.
When a file and the app disagree#
If a file changes on disk while you have unsaved edits to that same request, the two versions have diverged. API Client asks you to choose. Requests with no unsaved edits follow the file quietly. Only a request you are part-way through editing raises a conflict. The tree flags it on the request's row and offers two choices. Keep mine keeps your edits and overwrites the file on your next save. Take disk drops your edits and loads the file. API Client discards nothing until you choose.