https://linen.dev logo
#general
Title
# general
t

Tom

01/24/2023, 3:41 PM
Hi @Ramesh Hosmani you can create/edit/delete stubs and a load of other things via WireMock’s own REST API, which lives under the
/__admin/
path. You can hit this directly with curl, Postman or any other HTTP client. Check out https://wiremock.org/docs/api/ for reference, https://wiremock.org/docs/stubbing/ for examples.
r

Ramesh Hosmani

01/25/2023, 6:46 AM
Hello @Tom Thanks for the suggestion i need to connect to the server using truststore and keystore I did not find in the doc
Let me know if we have any east way to do it Right now i am using
Copy code
import requests
from OpenSSL import SSL

# Load the keystore and truststore
keystore = SSL.Context(SSL.SSLv23_METHOD)
keystore.use_privatekey_file('key.pem')
keystore.use_certificate_file('certificate.pem')

truststore = SSL.Context(SSL.SSLv23_METHOD)
truststore.load_verify_locations('truststore.pem')

# Create the session
session = requests.Session()
session.verify = '/truststore.pem'

# Send a GET request to the WireMock server
response = session.get('<https://elk.build.soasta.com:8443/__admin/mappings>', cert=('/key.pem'))

# Print the response body
print(response.text)
print(response.status_code)
This client to connect to it
I am able to connect to
__admin
through browser Thanks Tom
t

Tom

01/25/2023, 11:00 AM
Just so I understand correctly - you’re trying to get your Python client to trust WireMock’s self-signed certificate so you can connect over HTTPS (rather than HTTP)?
r

Ramesh Hosmani

01/25/2023, 11:00 AM
Yes
But i was not aware of the ui which lets me create stubs, above links which you posted was useful as well
t

Tom

01/25/2023, 11:02 AM
You can download a PEM encoded copy of WireMock’s cert from: http://localhost:8080/__admin/certs/wiremock-ca.crt (substituting whatever HTTP port you’ve allocated)
And yes, WireMock Cloud has a CA signed certificate on all HTTPS endpoints so you don’t need to do anything special in your client in order for it to be trusted.
👍 1
3 Views