### Ruby SDK Example for Get User by Name Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/get-user-by-name.md Provides a Ruby example for making a GET request to retrieve user details. ```ruby require 'uri' require 'net/http' url = URI("https://api/v3/user/username") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body ``` -------------------------------- ### Go SDK Example for Get User by Name Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/get-user-by-name.md Illustrates fetching user data with Go, including making an HTTP GET request and reading the response body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api/v3/user/username" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Python SDK Example for Get User by Name Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/get-user-by-name.md Demonstrates how to fetch user details using Python with the requests library. ```python import requests url = "https://api/v3/user/username" response = requests.get(url) print(response.json()) ``` -------------------------------- ### Swift SDK Example for Get User by Name Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/get-user-by-name.md Demonstrates how to fetch user details in Swift using URLSession for network requests. ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api/v3/user/username")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Get Pet Inventory (PHP) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-inventory.md This PHP example utilizes Guzzle HTTP client to retrieve pet inventory. Ensure you have Guzzle installed via Composer and replace `` with your key. ```php request('GET', 'https://api/v3/store/inventory', [ 'headers' => [ 'api_key' => '', ], ]); echo $response->getBody(); ?> ``` -------------------------------- ### C# SDK Example for Get User by Name Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/get-user-by-name.md A C# example utilizing RestSharp to execute a GET request for retrieving user data. ```csharp using RestSharp; var client = new RestClient("https://api/v3/user/username"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` -------------------------------- ### PHP SDK Example for Get User by Name Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/get-user-by-name.md This PHP example uses GuzzleHttp to perform a GET request to fetch user information. ```php request('GET', 'https://api/v3/user/username'); echo $response->getBody(); ``` -------------------------------- ### JavaScript SDK Example for Get User by Name Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/get-user-by-name.md Shows how to retrieve user information using JavaScript with the fetch API. ```javascript const url = 'https://api/v3/user/username'; const options = {method: 'GET'}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Java SDK Example for Get User by Name Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/get-user-by-name.md A Java code snippet demonstrating how to use Unirest to make a GET request for user data. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api/v3/user/username") .asString(); ``` -------------------------------- ### Create User Response Example Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-user.md Example of a successful response when creating a user, including the user's details. ```json { "id": 10, "username": "theUser", "firstName": "John", "lastName": "James", "email": "john@email.com", "password": "12345", "phone": "12345", "userStatus": 1 } ``` -------------------------------- ### Get Pet Inventory (JavaScript) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-inventory.md This JavaScript example demonstrates how to fetch pet inventory using the `fetch` API. It includes basic error handling and requires an API key. ```javascript const url = 'https://api/v3/store/inventory'; const options = {method: 'GET', headers: {api_key: ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### cURL Request Example for Get User by Username Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/get-user-by-name?explorer=true An example cURL command to demonstrate fetching a user by their username. Ensure the path parameter 'username' is correctly substituted. ```bash $| curl https://api/v3/user/username ---|--- ``` -------------------------------- ### Go HTTP Client Example for Get Order by ID Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-order-by-id.md This Go program demonstrates how to fetch a purchase order by ID using the standard net/http package. It prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api/v3/store/order/1" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Preview Documentation Locally Source: https://talkwell-884253.docs.buildwithfern.com/ Start a local development server with hot-reloading to preview your documentation at http://localhost:3000. ```bash $| fern docs dev ``` -------------------------------- ### Start Local Fern Docs Server Source: https://talkwell-884253.docs.buildwithfern.com/editing-your-docs.md Start a local development server to preview documentation changes with hot-reloading. Access the preview at http://localhost:3000. ```bash fern docs dev ``` -------------------------------- ### Ruby Net::HTTP Example for Creating Users Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-users-with-list-input.md Provides a Ruby example using Net::HTTP to perform a POST request for creating users with a JSON payload. ```ruby require 'uri' require 'net/http' url = URI("https://api/v3/user/createWithList") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "[ {} ]" response = http.request(request) puts response.read_body ``` -------------------------------- ### Python SDK Example for Creating Users Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-users-with-list-input.md Demonstrates how to use the Python requests library to send a POST request to create users with a list input. ```python import requests url = "https://api/v3/user/createWithList" payload = [{}] headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` -------------------------------- ### Create User with Ruby SDK Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-user.md Provides an example of creating a user using Ruby's Net::HTTP library. ```ruby require 'uri' require 'net/http' url = URI("https://api/v3/user") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` -------------------------------- ### cURL Request Example for Get Order by ID Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-order-by-id?explorer=true A cURL example demonstrating how to request a purchase order by its ID. This is useful for testing the API endpoint directly from the command line. ```shell $| curl https://api/v3/store/order/1 ---|--- ``` -------------------------------- ### User Login Response Example Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/login-user.md Example of a successful response from the user login API. ```json "string" ``` -------------------------------- ### Find Pet by Status (Swift) Source: https://talkwell-884253.docs.buildwithfern.com/%F0%9F%93%9D-support.md An example in Swift demonstrating how to make a GET request for pet data by status using URLSession. Ensure `` is replaced with your authorization token. ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api/v3/pet/findByStatus?status=available")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Java Unirest Example for Creating Users Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-users-with-list-input.md Demonstrates creating users with Java using the Unirest library to send a POST request with a JSON body. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api/v3/user/createWithList") .header("Content-Type", "application/json") .body("[ {} ]") .asString(); ``` -------------------------------- ### Get Pet by ID - Ruby SDK Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/pet/get-pet-by-id.md Make a GET request to fetch pet information using Ruby's `Net::HTTP` library. This example includes setting up SSL, adding the API key, and printing the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api/v3/pet/1") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["api_key"] = '' response = http.request(request) puts response.read_body ``` -------------------------------- ### Python SDK Example for Get Order by ID Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-order-by-id.md Use this Python snippet with the requests library to make a GET request to retrieve a purchase order by its ID. Ensure the URL is correctly formatted. ```python import requests url = "https://api/v3/store/order/1" response = requests.get(url) print(response.json()) ``` -------------------------------- ### Go SDK for User Logout Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/logout-user.md Example of how to log out a user using Go's standard net/http package. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api/v3/user/logout" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Find Pets by Tags (Go) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/pet/find-pets-by-tags.md A Go program to find pets by tags. This example demonstrates making an HTTP GET request with an Authorization header and printing the response body. Remember to replace '' with your API token. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api/v3/pet/findByTags?tags=%5B%22string%22%5D" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### cURL Request Example (API Explorer) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/pet/get-pet-by-id?explorer=true This cURL command is an example generated by the API Explorer for fetching a pet by ID. It includes a placeholder for the API key. ```bash $ curl https://api/v3/pet/1 \ -H "api_key: " ``` -------------------------------- ### Go HTTP Client for User Login Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/login-user.md This Go program demonstrates how to make an HTTP GET request to the user login endpoint. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api/v3/user/login" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Example JSON Response Body Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-users-with-list-input.md An example of a successful JSON response when creating a user, showing the structure of a User object. ```json { "id": 10, "username": "theUser", "firstName": "John", "lastName": "James", "email": "john@email.com", "password": "12345", "phone": "12345", "userStatus": 1 } ``` -------------------------------- ### Example JSON Request Body Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-users-with-list-input.md An example of the JSON payload for creating users, containing an empty user object. ```json [ {} ] ``` -------------------------------- ### Swift URLSession Example for Creating Users Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-users-with-list-input.md Demonstrates creating users with Swift using URLSession to send a POST request with a JSON payload. ```swift import Foundation let headers = ["Content-Type": "application/json"] let parameters = [[]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api/v3/user/createWithList")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Get Pet Inventory (Go) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-inventory.md This Go program retrieves pet inventory data. It constructs an HTTP GET request with the necessary API key header and prints the response body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api/v3/store/inventory" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("api_key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Install Fern CLI Source: https://talkwell-884253.docs.buildwithfern.com/editing-your-docs.md Install the Fern CLI globally using npm. This command is required before using other Fern CLI commands. ```bash npm install -g fern-api ``` -------------------------------- ### Java SDK for User Logout Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/logout-user.md Example of how to log out a user using Java with the Unirest library. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api/v3/user/logout") .asString(); ``` -------------------------------- ### Ruby SDK for User Logout Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/logout-user.md Example of how to log out a user using Ruby's Net::HTTP library. ```ruby require 'uri' require 'net/http' url = URI("https://api/v3/user/logout") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body ``` -------------------------------- ### Create User with C# SDK (RestSharp) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-user.md Provides an example of creating a user using the RestSharp library in C#. ```csharp using RestSharp; var client = new RestClient("https://api/v3/user"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Get Pet Inventory (Python) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-inventory.md Use this Python snippet to make a GET request to the store inventory endpoint. Ensure you replace `` with your actual API key. ```python import requests url = "https://api/v3/store/inventory" headers = {"api_key": ""} response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Delete User with Go Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/delete-user.md Provides a Go example for deleting a user. It demonstrates creating an HTTP DELETE request and reading the response body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api/v3/user/username" req, _ := http.NewRequest("DELETE", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Swift SDK for User Logout Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/logout-user.md Example of how to log out a user using Swift with URLSession. ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api/v3/user/logout")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Go HTTP Client Example for Creating Users Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-users-with-list-input.md Illustrates creating users using Go's standard net/http package to make a POST request with a JSON body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/v3/user/createWithList" payload := strings.NewReader("[ {} ]") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### PHP SDK for User Logout Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/logout-user.md Example of how to log out a user using PHP with Guzzle HTTP client. ```php request('GET', 'https://api/v3/user/logout'); echo $response->getBody(); ``` -------------------------------- ### Python SDK for User Logout Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/logout-user.md Example of how to log out a user using Python with the requests library. ```python import requests url = "https://api/v3/user/logout" response = requests.get(url) print(response.json()) ``` -------------------------------- ### Create User with Go SDK Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-user.md Illustrates creating a user using Go's standard http library. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/v3/user" payload := strings.NewReader("{}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Java Unirest for User Login Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/login-user.md Example of using the Unirest library in Java to call the user login API. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api/v3/user/login") .asString(); ``` -------------------------------- ### C# SDK for User Logout Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/logout-user.md Example of how to log out a user using C# with RestSharp. ```csharp using RestSharp; var client = new RestClient("https://api/v3/user/logout"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Clone Fern Template Repository Source: https://talkwell-884253.docs.buildwithfern.com/welcome.md Clone the Fern template repository to start building your documentation. Navigate into the cloned directory afterwards. ```bash git clone cd docs-starter ``` -------------------------------- ### JavaScript (Node.js/Browser) SDK for User Logout Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/logout-user.md Example of how to log out a user using JavaScript with the fetch API. ```javascript const url = 'https://api/v3/user/logout'; const options = {method: 'GET'}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Create User with Java SDK (Unirest) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-user.md Demonstrates creating a user using the Unirest library in Java. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api/v3/user") .header("Content-Type", "application/json") .body("{}") .asString(); ``` -------------------------------- ### Swift URLSession Example for Get Order by ID Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-order-by-id.md This Swift code demonstrates fetching a purchase order by ID using URLSession. It configures an NSMutableURLRequest for a GET operation and handles the response. ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api/v3/store/order/1")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### C# RestSharp Example for Get Order by ID Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-order-by-id.md This C# code uses the RestSharp library to execute a GET request for fetching a purchase order by its ID. It captures and processes the IRestResponse. ```csharp using RestSharp; var client = new RestClient("https://api/v3/store/order/1"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Java Unirest Example for Get Order by ID Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-order-by-id.md This Java code uses the Unirest library to make a GET request to fetch a purchase order by its ID. It retrieves the response as a string. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api/v3/store/order/1") .asString(); ``` -------------------------------- ### Update User with Java (Unirest) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/update-user.md An example of updating a user using the Unirest library in Java. This snippet simplifies making HTTP requests. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.put("https://api/v3/user/username") .header("Content-Type", "application/json") .body("{}") .asString(); ``` -------------------------------- ### PHP Guzzle Example for Get Order by ID Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-order-by-id.md This PHP snippet utilizes the Guzzle HTTP client to perform a GET request for retrieving a purchase order by its ID. It outputs the response body. ```php request('GET', 'https://api/v3/store/order/1'); echo $response->getBody(); ``` -------------------------------- ### JavaScript Fetch API Example for Get Order by ID Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-order-by-id.md This JavaScript code uses the fetch API to get a purchase order by ID. It handles the response and logs the JSON data or any errors encountered. ```javascript const url = 'https://api/v3/store/order/1'; const options = {method: 'GET'}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### JavaScript Fetch API Example for Creating Users Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-users-with-list-input.md Shows how to use the JavaScript fetch API to create users by sending a POST request with a JSON payload. ```javascript const url = 'https://api/v3/user/createWithList'; const options = {method: 'POST', headers: {'Content-Type': 'application/json'}, body: '[{}]'}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Ruby Net::HTTP Example for Get Order by ID Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-order-by-id.md This Ruby snippet shows how to retrieve a purchase order by ID using the Net::HTTP library. It makes a GET request and prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api/v3/store/order/1") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body ``` -------------------------------- ### Get Pet by ID - JavaScript SDK Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/pet/get-pet-by-id.md Fetch pet details using JavaScript's `fetch` API. This example demonstrates making a GET request with an API key in the headers and handling the JSON response. ```javascript const url = 'https://api/v3/pet/1'; const options = {method: 'GET', headers: {api_key: ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Create User with Swift SDK Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-user.md Demonstrates creating a user using Swift's URLSession. ```swift import Foundation let headers = ["Content-Type": "application/json"] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api/v3/user")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Create User with Python SDK Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-user.md Demonstrates how to create a user using the Python requests library. ```python import requests url = "https://api/v3/user" payload = {} headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` -------------------------------- ### Log into the system (JavaScript) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/login-user?explorer=true This JavaScript snippet demonstrates how to log a user into the system using the API. It requires username and password as query parameters. ```javascript const fetch = require('node-fetch'); const url = 'https://api/v3/user/login'; fetch(url, { method: 'GET' }) .then(response => { console.log('Status Code:', response.status); return response.json(); }) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### Place Order using Go HTTP Client Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/place-order.md Implement order placement in Go using the standard `net/http` package. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/v3/store/order" payload := strings.NewReader("{}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Successful Response for Get User by Username Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/get-user-by-name?explorer=true This is an example of a successful JSON response when retrieving user data by username. It includes user details such as ID, username, name, email, and status. ```json 1| { ---|--- 2| "id": 10, 3| "username": "theUser", 4| "firstName": "John", 5| "lastName": "James", 6| "email": "john@email.com", 7| "password": "12345", 8| "phone": "12345", 9| "userStatus": 1 10| } ``` -------------------------------- ### Publish Docs to Production Source: https://talkwell-884253.docs.buildwithfern.com/editing-your-docs.md Build and publish your documentation to its production URL. This command should be used when the documentation is ready for public access. ```bash fern generate --docs ``` -------------------------------- ### Get Pet by ID - Swift SDK Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/pet/get-pet-by-id.md Fetch pet information using Swift's `URLSession` and `NSMutableURLRequest`. This example shows how to configure the request with the API key and handle the response. ```swift import Foundation let headers = ["api_key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api/v3/pet/1")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Create User with PHP SDK (Guzzle) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-user.md Shows how to create a user using the Guzzle HTTP client in PHP. ```php request('POST', 'https://api/v3/user', [ 'body' => '{}', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` -------------------------------- ### Update Pet using PHP (Guzzle) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/pet/update-pet.md This PHP example utilizes the Guzzle HTTP client to update pet data. Ensure you have Guzzle installed via Composer and substitute '' with your API key. ```php request('PUT', 'https://api/v3/pet', [ 'body' => '{\n \"name\": \"doggie\",\n \"photoUrls\": [\n \"string\"\n ]\n}', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` -------------------------------- ### Get Pet by ID - PHP SDK Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/pet/get-pet-by-id.md Fetch pet details using PHP with the Guzzle HTTP client. This example shows how to set the API key in the request headers and echo the response body. ```php request('GET', 'https://api/v3/pet/1', [ 'headers' => [ 'api_key' => '', ], ]); echo $response->getBody(); ?> ``` -------------------------------- ### Clone Fern Documentation Repository Source: https://talkwell-884253.docs.buildwithfern.com/ Clone the starter template repository to begin customizing your documentation. ```bash $| git clone $| cd docs-starter ``` -------------------------------- ### Successful Response for Get Order by ID Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-order-by-id?explorer=true This is an example of a successful JSON response when retrieving a purchase order. It includes details such as the order ID, pet ID, quantity, ship date, status, and completion status. ```json 1| { ---|--- 2| "id": 10, 3| "petId": 198772, 4| "quantity": 7, 5| "shipDate": "2024-01-15T09:30:00Z", 6| "status": "approved", 7| "complete": true 8| } ``` -------------------------------- ### Log into the system (Python) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/login-user?explorer=true This Python snippet shows how to log a user into the system using the API. It requires username and password as query parameters. ```python import requests url = 'https://api/v3/user/login' response = requests.get(url) print('Status Code:', response.status_code) print('Response JSON:', response.json()) ``` -------------------------------- ### Create User with JavaScript (Fetch API) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-user.md Shows how to create a user using the Fetch API in JavaScript. ```javascript const url = 'https://api/v3/user'; const options = {method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{}'}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Update Pet with Form - PHP SDK (Guzzle) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/pet/update-pet-with-form.md This PHP example uses the Guzzle HTTP client to update pet information. It includes setting the Authorization header. Remember to replace '' with your authorization token and ensure Guzzle is installed. ```php request('POST', 'https://api/v3/pet/1', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ?> ``` -------------------------------- ### Find Pets by Tags (PHP) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/pet/find-pets-by-tags.md A PHP example using Guzzle to find pets by tags. This code sets the Authorization header and makes the GET request. Make sure to include Guzzle via Composer and replace '' with your API token. ```php request('GET', 'https://api/v3/pet/findByTags?tags=%5B%22string%22%5D', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ?> ``` -------------------------------- ### Find Pet by Status (Go) Source: https://talkwell-884253.docs.buildwithfern.com/%F0%9F%93%9D-support.md This Go program demonstrates how to make a GET request to find pets by status. It includes reading the response body and printing it. Ensure your token is correctly substituted for ``. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api/v3/pet/findByStatus?status=available" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Place Order cURL Example Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/place-order?explorer=true Use this cURL command to place a new order in the store. Ensure the Content-Type header is set to application/json and provide the order details in the request body. ```shell $ curl -X POST https:/https://api/v3/store/order \ -H "Content-Type: application/json" \ -d '{}' ``` -------------------------------- ### Empty JSON Response Example Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-inventory.md An example of an empty JSON response that might be returned by the inventory endpoint. ```json {} ``` -------------------------------- ### PHP Guzzle HTTP Client Example for Creating Users Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/create-users-with-list-input.md Shows how to create users using the Guzzle HTTP client in PHP, sending a POST request with a JSON payload. ```php request('POST', 'https://api/v3/user/createWithList', [ 'body' => '[\n {}\n]', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` -------------------------------- ### cURL Example for Uploading Pet Image Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/pet/upload-file?explorer=true This cURL command demonstrates how to upload a pet image. Ensure you replace `` with your actual authorization token and specify the correct `petId`. ```bash $ curl -X POST https://api/v3/pet/1/uploadImage \ -H "Authorization: Bearer " \ -H "Content-Type: application/octet-stream" ``` -------------------------------- ### Swift URLSession Example for Delete Order Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/delete-order.md This Swift example shows how to use URLSession to send a DELETE request to the store order endpoint. ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api/v3/store/order/1")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "DELETE" let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### OpenAPI Specification for Get Inventory Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-inventory.md This OpenAPI 3.1.0 specification defines the GET /store/inventory endpoint, including parameters, responses, and security schemes. ```yaml openapi: 3.1.0 info: title: example-openapi version: 1.0.0 paths: /store/inventory: get: operationId: get-inventory summary: Returns pet inventories by status. description: Returns a map of status codes to quantities. tags: - store parameters: - name: api_key in: header required: true schema: type: string responses: '200': description: successful operation content: application/json: schema: type: object additionalProperties: type: integer servers: - url: /api/v3 description: /api/v3 components: securitySchemes: api_key: type: apiKey in: header name: api_key ``` -------------------------------- ### C# RestSharp Example for Delete Order Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/delete-order.md This C# example demonstrates using the RestSharp library to execute a DELETE request against the store order endpoint. ```csharp using RestSharp; var client = new RestClient("https://api/v3/store/order/1"); var request = new RestRequest(Method.DELETE); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Log into the system (cURL) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/login-user?explorer=true Use this cURL command to log a user into the system. It requires username and password as query parameters. ```bash $ curl https://api/v3/user/login ``` -------------------------------- ### PHP Guzzle Example for Delete Order Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/delete-order.md This PHP example uses the Guzzle HTTP client to send a DELETE request to the store order endpoint. ```php request('DELETE', 'https://api/v3/store/order/1'); echo $response->getBody(); ``` -------------------------------- ### Update Pet using Go Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/pet/update-pet.md This Go code example shows how to update pet information. It constructs an HTTP PUT request with the necessary headers and payload. Remember to replace '' with your authorization token. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/v3/pet" payload := strings.NewReader("{\n \"name\": \"doggie\",\n \"photoUrls\": [\n \"string\"\n ]\n}") req, _ := http.NewRequest("PUT", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Ruby Net::HTTP Example for Delete Order Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/delete-order.md This Ruby example uses the Net::HTTP library to send a DELETE request to the store order endpoint. ```ruby require 'uri' require 'net/http' url = URI("https://api/v3/store/order/1") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Delete.new(url) response = http.request(request) puts response.read_body ``` -------------------------------- ### JavaScript Fetch API Example for Delete Order Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/delete-order.md This JavaScript example demonstrates how to use the Fetch API to send a DELETE request to the store order endpoint. ```javascript const url = 'https://api/v3/store/order/1'; const options = {method: 'DELETE'}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### OpenAPI Specification for Get User by Name Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/get-user-by-name.md The OpenAPI 3.1.0 specification defining the GET /user/{username} endpoint, including parameters, responses, and the User schema. ```yaml openapi: 3.1.0 info: title: example-openapi version: 1.0.0 paths: /user/{username}: get: operationId: get-user-by-name summary: Get user by user name. description: Get user detail based on username. tags: - user parameters: - name: username in: path description: The name that needs to be fetched. Use user1 for testing required: true schema: type: string responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/User' '400': description: Invalid username supplied content: application/json: schema: description: Any type '404': description: User not found content: application/json: schema: description: Any type servers: - url: /api/v3 description: /api/v3 components: schemas: User: type: object properties: id: type: integer format: int64 username: type: string firstName: type: string lastName: type: string email: type: string password: type: string phone: type: string userStatus: type: integer description: User Status title: User ``` -------------------------------- ### cURL Request to Get User by Username Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/user/get-user-by-name?explorer=true Use this cURL command to make a GET request to retrieve a user's details by their username. Replace 'username' with the actual username. ```bash $| curl https:/https://api/v3/user/username ---|--- ``` -------------------------------- ### Configure Documentation Instance URL Source: https://talkwell-884253.docs.buildwithfern.com/ Set the 'url' for your documentation instance in the 'docs.yml' file. This specifies where your documentation will be hosted. ```yaml 1| instances: 2| - url: your-org.docs.buildwithfern.com ``` -------------------------------- ### Get Pet Inventory (Java) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-inventory.md This Java code snippet uses the Unirest library to make a GET request for pet inventory. Remember to include the Unirest dependency in your project. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api/v3/store/inventory") .header("api_key", "") .asString(); ``` -------------------------------- ### Get Pet by ID - Python SDK Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/pet/get-pet-by-id.md Use the Python SDK to make a GET request to retrieve a pet by its ID. Ensure you replace `` with your actual API key. ```python import requests url = "https://api/v3/pet/1" headers = {"api_key": ""} response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Get Pet Inventory (Swift) Source: https://talkwell-884253.docs.buildwithfern.com/api-reference/swagger-petstore-open-api-3-0/store/get-inventory.md This Swift code snippet shows how to make a GET request for pet inventory using URLSession. It configures the request with the necessary API key header. ```swift import Foundation let headers = ["api_key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api/v3/store/inventory")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```