Skip to main content
POST
/
v1
/
generate
Generate mock data
curl --request POST \
  --url https://mockwise.dev/api/v1/generate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data 'schema={
  "mock": {
    "first_name": {
      "type": "firstName"
    },
    "last_name": {
      "type": "lastName"
    }
  },
  "locale": "pt_BR",
  "repeat": 1,
  "show_errors": false,
  "single_item": true,
  "wrap": null
}'
import requests

url = "https://mockwise.dev/api/v1/generate"

payload = { "schema": "{
\"mock\": {
\"first_name\": {
\"type\": \"firstName\"
},
\"last_name\": {
\"type\": \"lastName\"
}
},
\"locale\": \"pt_BR\",
\"repeat\": 1,
\"show_errors\": false,
\"single_item\": true,
\"wrap\": null
}" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/x-www-form-urlencoded"
}

response = requests.post(url, data=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
schema: '{\n "mock": {\n "first_name": {\n "type": "firstName"\n },\n "last_name": {\n "type": "lastName"\n }\n },\n "locale": "pt_BR",\n "repeat": 1,\n "show_errors": false,\n "single_item": true,\n "wrap": null\n}'
})
};

fetch('https://mockwise.dev/api/v1/generate', 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://mockwise.dev/api/v1/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "schema=%7B%0A%20%20%22mock%22%3A%20%7B%0A%20%20%20%20%22first_name%22%3A%20%7B%0A%20%20%20%20%20%20%22type%22%3A%20%22firstName%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22last_name%22%3A%20%7B%0A%20%20%20%20%20%20%22type%22%3A%20%22lastName%22%0A%20%20%20%20%7D%0A%20%20%7D%2C%0A%20%20%22locale%22%3A%20%22pt_BR%22%2C%0A%20%20%22repeat%22%3A%201%2C%0A%20%20%22show_errors%22%3A%20false%2C%0A%20%20%22single_item%22%3A%20true%2C%0A%20%20%22wrap%22%3A%20null%0A%7D",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/x-www-form-urlencoded"
],
]);

$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://mockwise.dev/api/v1/generate"

payload := strings.NewReader("schema=%7B%0A%20%20%22mock%22%3A%20%7B%0A%20%20%20%20%22first_name%22%3A%20%7B%0A%20%20%20%20%20%20%22type%22%3A%20%22firstName%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22last_name%22%3A%20%7B%0A%20%20%20%20%20%20%22type%22%3A%20%22lastName%22%0A%20%20%20%20%7D%0A%20%20%7D%2C%0A%20%20%22locale%22%3A%20%22pt_BR%22%2C%0A%20%20%22repeat%22%3A%201%2C%0A%20%20%22show_errors%22%3A%20false%2C%0A%20%20%22single_item%22%3A%20true%2C%0A%20%20%22wrap%22%3A%20null%0A%7D")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://mockwise.dev/api/v1/generate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("schema=%7B%0A%20%20%22mock%22%3A%20%7B%0A%20%20%20%20%22first_name%22%3A%20%7B%0A%20%20%20%20%20%20%22type%22%3A%20%22firstName%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22last_name%22%3A%20%7B%0A%20%20%20%20%20%20%22type%22%3A%20%22lastName%22%0A%20%20%20%20%7D%0A%20%20%7D%2C%0A%20%20%22locale%22%3A%20%22pt_BR%22%2C%0A%20%20%22repeat%22%3A%201%2C%0A%20%20%22show_errors%22%3A%20false%2C%0A%20%20%22single_item%22%3A%20true%2C%0A%20%20%22wrap%22%3A%20null%0A%7D")
.asString();
require 'uri'
require 'net/http'

url = URI("https://mockwise.dev/api/v1/generate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "schema=%7B%0A%20%20%22mock%22%3A%20%7B%0A%20%20%20%20%22first_name%22%3A%20%7B%0A%20%20%20%20%20%20%22type%22%3A%20%22firstName%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22last_name%22%3A%20%7B%0A%20%20%20%20%20%20%22type%22%3A%20%22lastName%22%0A%20%20%20%20%7D%0A%20%20%7D%2C%0A%20%20%22locale%22%3A%20%22pt_BR%22%2C%0A%20%20%22repeat%22%3A%201%2C%0A%20%20%22show_errors%22%3A%20false%2C%0A%20%20%22single_item%22%3A%20true%2C%0A%20%20%22wrap%22%3A%20null%0A%7D"

response = http.request(request)
puts response.read_body
[
  {
    "first_name": "Talon",
    "last_name": "Kilback"
  }
]
{
"message": "Unauthenticated."
}
{
"error": "Invalid Argument: `schema` is required."
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/x-www-form-urlencoded
schema
object
required

Response

Successfully generated mock data