Pull OpenAPI document from Git
curl --request POST \
--url https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}/open-api/pull \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"pull": {
"outOfSyncPolicy": "abort"
}
}
'import requests
url = "https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}/open-api/pull"
payload = { "pull": { "outOfSyncPolicy": "abort" } }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({pull: {outOfSyncPolicy: 'abort'}})
};
fetch('https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}/open-api/pull', 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}/open-api/pull",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'pull' => [
'outOfSyncPolicy' => 'abort'
]
]),
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}/open-api/pull"
payload := strings.NewReader("{\n \"pull\": {\n \"outOfSyncPolicy\": \"abort\"\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}/open-api/pull")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"pull\": {\n \"outOfSyncPolicy\": \"abort\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}/open-api/pull")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"pull\": {\n \"outOfSyncPolicy\": \"abort\"\n }\n}"
response = http.request(request)
puts response.read_body{
"job": {
"id": "5947aff3-947b-4dfb-90f5-d324684e97db",
"jobType": "open-api-git-pull",
"status": "ERROR",
"started": "2024-09-05T10:20:46.143759190Z",
"links": {
"self": "/v1/mock-apis/0ozge/__admin/etc/jobs/5947aff3-947b-4dfb-90f5-d324684e97db"
},
"finished": "2024-09-05T10:20:46.200386224Z",
"elapsed": "PT0.056627034S",
"outcome": {
"errorCode": "NO_LOCAL_HEAD",
"errors": [
{
"code": 112,
"title": "No previous pull",
"detail": "This is the first time pulling from Git."
}
]
}
}
}OpenAPI
Pull OpenAPI document from Git
POST
/
v1
/
mock-apis
/
{mockApiId}
/
open-api
/
pull
Pull OpenAPI document from Git
curl --request POST \
--url https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}/open-api/pull \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"pull": {
"outOfSyncPolicy": "abort"
}
}
'import requests
url = "https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}/open-api/pull"
payload = { "pull": { "outOfSyncPolicy": "abort" } }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({pull: {outOfSyncPolicy: 'abort'}})
};
fetch('https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}/open-api/pull', 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}/open-api/pull",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'pull' => [
'outOfSyncPolicy' => 'abort'
]
]),
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}/open-api/pull"
payload := strings.NewReader("{\n \"pull\": {\n \"outOfSyncPolicy\": \"abort\"\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}/open-api/pull")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"pull\": {\n \"outOfSyncPolicy\": \"abort\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}/open-api/pull")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"pull\": {\n \"outOfSyncPolicy\": \"abort\"\n }\n}"
response = http.request(request)
puts response.read_body{
"job": {
"id": "5947aff3-947b-4dfb-90f5-d324684e97db",
"jobType": "open-api-git-pull",
"status": "ERROR",
"started": "2024-09-05T10:20:46.143759190Z",
"links": {
"self": "/v1/mock-apis/0ozge/__admin/etc/jobs/5947aff3-947b-4dfb-90f5-d324684e97db"
},
"finished": "2024-09-05T10:20:46.200386224Z",
"elapsed": "PT0.056627034S",
"outcome": {
"errorCode": "NO_LOCAL_HEAD",
"errors": [
{
"code": 112,
"title": "No previous pull",
"detail": "This is the first time pulling from Git."
}
]
}
}
}Path Parameters
The ID of the Mock API
Required string length:
5 - 10Example:
"jjl8y"
Body
application/json
Show child attributes
Show child attributes
Response
202 - application/json
Pull job successfully initiated
Show child attributes
Show child attributes
⌘I