Hello! I'm looking into the way how can I import t...
# help
Hello! I'm looking into the way how can I import the prerecorded scenario with several requests into the running Wiremock instance with Admin REST API. I need to import the whole folder with multiple recorded mock JSON files but here I can se how I can do that only with Java API? https://docs.wiremock.io/import-export/wiremock/ Is there a way to do that with pure REST API?
Hi @TheUsharik if you’d like to use WireMock Java to upload a folder to WireMock Cloud, you need to do something like:
Copy code
WireMock wm = WireMock.create()
                    .authenticator(new ClientTokenAuthenticator("<API token>"))

wm.loadMappingsFrom("/path/to/folder"); // Should be the parent folder of "mappings"
Thank you, but we are using Wiremock as a docker container and we need to change the path to the mapping folder on the run. Is that possible with admin REST API?
WireMock Docker image loads the configuration files on startup. While you can definitely use the admin API to add more mappings, for me it seems to be going against the best practices. Normally it is advised to use a static image where all the configurations are bundled Why wouldn't you need to add it on the flight?
Because we have several scenaries and we need to switch between them.
In this case I suggest pulling the single, all-stubs JSON from the API e.g.
GET http://<docker host>:<docker port>/__admin/mappings
then posting this to the WireMock Cloud import API endpoint, which is