Update mock API
curl --request PUT \
--url https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"mockApi": {
"name": "My modified mock API",
"hostname": "my-new-mock-api",
"adminSecurityEnabled": false
}
}
'import requests
url = "https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}"
payload = { "mockApi": {
"name": "My modified mock API",
"hostname": "my-new-mock-api",
"adminSecurityEnabled": False
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
mockApi: {
name: 'My modified mock API',
hostname: 'my-new-mock-api',
adminSecurityEnabled: false
}
})
};
fetch('https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'mockApi' => [
'name' => 'My modified mock API',
'hostname' => 'my-new-mock-api',
'adminSecurityEnabled' => false
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}"
payload := strings.NewReader("{\n \"mockApi\": {\n \"name\": \"My modified mock API\",\n \"hostname\": \"my-new-mock-api\",\n \"adminSecurityEnabled\": false\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"mockApi\": {\n \"name\": \"My modified mock API\",\n \"hostname\": \"my-new-mock-api\",\n \"adminSecurityEnabled\": false\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"mockApi\": {\n \"name\": \"My modified mock API\",\n \"hostname\": \"my-new-mock-api\",\n \"adminSecurityEnabled\": false\n }\n}"
response = http.request(request)
puts response.read_body{
"mockApi": {
"id": "jjl8y",
"aclObject": "gkqjy",
"name": "My modified mock API",
"description": "This is a modified mock API for testing purposes.",
"state": "RUNNING",
"adminSecurityEnabled": true,
"exportState": "EXPORT_ALLOWED",
"createdDate": "2024-08-23T21:34:36.595372Z",
"openApiGitIntegration": "jjl8y-openapi-integration-git",
"links": {
"self": "/v1/mock-apis/jjl8y",
"requests": "/v1/mock-apis/jjl8y/requests",
"mappings": "/v1/mock-apis/jjl8y/mappings",
"scenarios": "/v1/mock-apis/jjl8y/scenarios",
"recordings": {
"start": "/v1/mock-apis/jjl8y/recordings/start",
"stop": "/v1/mock-apis/jjl8y/recordings/stop",
"status": "/v1/mock-apis/jjl8y/recordings/status",
"snapshot": "/v1/mock-apis/jjl8y/recordings/snapshot"
},
"imports": "/v1/mock-apis/jjl8y/imports",
"organisation": "/v1/organisations/mgk7g",
"apiTemplate": "/v1/api-templates/8nd5x",
"aclObject": "/v1/acl/objects/gkqjy",
"aclRoles": "/v1/acl/objects/gkqjy/roles",
"invitations": "/v1/mock-apis/jjl8y/invitations",
"acl": "/v1/mock-apis/jjl8y/acl{?subjectId}",
"versionHistoryCommits": "/v1/mock-apis/jjl8y/version-history/commits"
},
"baseUrl": "https://jjl8y.wiremockapi.cloud",
"domainNames": [
{
"domainName": "my-new-mock-api.wiremockapi.cloud",
"editableSubdomainPart": "my-new-mock-api",
"urls": [
{
"url": "https://my-new-mock-api.wiremockapi.cloud"
},
{
"url": "http://my-new-mock-api.wiremockapi.cloud"
}
]
},
{
"domainName": "jjl8y.wiremockapi.cloud",
"urls": [
{
"url": "https://jjl8y.wiremockapi.cloud"
},
{
"url": "http://jjl8y.wiremockapi.cloud"
}
]
}
],
"domains": [
"jjl8y.wiremockapi.cloud",
"my-new-mock-api.wiremockapi.cloud"
]
}
}{
"errors": [
{
"title": "Forbidden",
"source": {}
}
]
}{
"errors": [
{
"title": "Invalid JSON",
"detail": "json pointer /mockApi not present; it is required and must have json type object",
"source": {}
}
]
}Mock APIs
Update mock API
PUT
/
v1
/
mock-apis
/
{mockApiId}
Update mock API
curl --request PUT \
--url https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"mockApi": {
"name": "My modified mock API",
"hostname": "my-new-mock-api",
"adminSecurityEnabled": false
}
}
'import requests
url = "https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}"
payload = { "mockApi": {
"name": "My modified mock API",
"hostname": "my-new-mock-api",
"adminSecurityEnabled": False
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
mockApi: {
name: 'My modified mock API',
hostname: 'my-new-mock-api',
adminSecurityEnabled: false
}
})
};
fetch('https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'mockApi' => [
'name' => 'My modified mock API',
'hostname' => 'my-new-mock-api',
'adminSecurityEnabled' => false
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}"
payload := strings.NewReader("{\n \"mockApi\": {\n \"name\": \"My modified mock API\",\n \"hostname\": \"my-new-mock-api\",\n \"adminSecurityEnabled\": false\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"mockApi\": {\n \"name\": \"My modified mock API\",\n \"hostname\": \"my-new-mock-api\",\n \"adminSecurityEnabled\": false\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"mockApi\": {\n \"name\": \"My modified mock API\",\n \"hostname\": \"my-new-mock-api\",\n \"adminSecurityEnabled\": false\n }\n}"
response = http.request(request)
puts response.read_body{
"mockApi": {
"id": "jjl8y",
"aclObject": "gkqjy",
"name": "My modified mock API",
"description": "This is a modified mock API for testing purposes.",
"state": "RUNNING",
"adminSecurityEnabled": true,
"exportState": "EXPORT_ALLOWED",
"createdDate": "2024-08-23T21:34:36.595372Z",
"openApiGitIntegration": "jjl8y-openapi-integration-git",
"links": {
"self": "/v1/mock-apis/jjl8y",
"requests": "/v1/mock-apis/jjl8y/requests",
"mappings": "/v1/mock-apis/jjl8y/mappings",
"scenarios": "/v1/mock-apis/jjl8y/scenarios",
"recordings": {
"start": "/v1/mock-apis/jjl8y/recordings/start",
"stop": "/v1/mock-apis/jjl8y/recordings/stop",
"status": "/v1/mock-apis/jjl8y/recordings/status",
"snapshot": "/v1/mock-apis/jjl8y/recordings/snapshot"
},
"imports": "/v1/mock-apis/jjl8y/imports",
"organisation": "/v1/organisations/mgk7g",
"apiTemplate": "/v1/api-templates/8nd5x",
"aclObject": "/v1/acl/objects/gkqjy",
"aclRoles": "/v1/acl/objects/gkqjy/roles",
"invitations": "/v1/mock-apis/jjl8y/invitations",
"acl": "/v1/mock-apis/jjl8y/acl{?subjectId}",
"versionHistoryCommits": "/v1/mock-apis/jjl8y/version-history/commits"
},
"baseUrl": "https://jjl8y.wiremockapi.cloud",
"domainNames": [
{
"domainName": "my-new-mock-api.wiremockapi.cloud",
"editableSubdomainPart": "my-new-mock-api",
"urls": [
{
"url": "https://my-new-mock-api.wiremockapi.cloud"
},
{
"url": "http://my-new-mock-api.wiremockapi.cloud"
}
]
},
{
"domainName": "jjl8y.wiremockapi.cloud",
"urls": [
{
"url": "https://jjl8y.wiremockapi.cloud"
},
{
"url": "http://jjl8y.wiremockapi.cloud"
}
]
}
],
"domains": [
"jjl8y.wiremockapi.cloud",
"my-new-mock-api.wiremockapi.cloud"
]
}
}{
"errors": [
{
"title": "Forbidden",
"source": {}
}
]
}{
"errors": [
{
"title": "Invalid JSON",
"detail": "json pointer /mockApi not present; it is required and must have json type object",
"source": {}
}
]
}Path Parameters
The ID of the Mock API
Required string length:
5 - 10Example:
"jjl8y"
Body
application/json
Show child attributes
Show child attributes
Response
200 response
Show child attributes
Show child attributes
⌘I