createPets
Create a pet
/pets
Usage and SDK Samples
curl -X POST "http://petstore.swagger.io/v1/pets"
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.PetsApi;
import java.io.File;
import java.util.*;
public class PetsApiExample {
public static void main(String[] args) {
PetsApi apiInstance = new PetsApi();
try {
apiInstance.createPets();
} catch (ApiException e) {
System.err.println("Exception when calling PetsApi#createPets");
e.printStackTrace();
}
}
}
import org.openapitools.client.api.PetsApi;
public class PetsApiExample {
public static void main(String[] args) {
PetsApi apiInstance = new PetsApi();
try {
apiInstance.createPets();
} catch (ApiException e) {
System.err.println("Exception when calling PetsApi#createPets");
e.printStackTrace();
}
}
}
PetsApi *apiInstance = [[PetsApi alloc] init];
// Create a pet
[apiInstance createPetsWithCompletionHandler:
^(NSError* error) {
if (error) {
NSLog(@"Error: %@", error);
}
}];
var SwaggerPetstoreV3OpenApi3 = require('swagger_petstore_v3__open_api_3');
var api = new SwaggerPetstoreV3OpenApi3.PetsApi()
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
};
api.createPets(callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class createPetsExample
{
public void main()
{
var apiInstance = new PetsApi();
try
{
// Create a pet
apiInstance.createPets();
}
catch (Exception e)
{
Debug.Print("Exception when calling PetsApi.createPets: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new OpenAPITools\Client\Api\PetsApi();
try {
$api_instance->createPets();
} catch (Exception $e) {
echo 'Exception when calling PetsApi->createPets: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::PetsApi;
my $api_instance = WWW::OPenAPIClient::PetsApi->new();
eval {
$api_instance->createPets();
};
if ($@) {
warn "Exception when calling PetsApi->createPets: $@\n";
}
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = openapi_client.PetsApi()
try:
# Create a pet
api_instance.create_pets()
except ApiException as e:
print("Exception when calling PetsApi->createPets: %s\n" % e)
extern crate PetsApi;
pub fn main() {
let mut context = PetsApi::Context::default();
let result = client.createPets(&context).wait();
println!("{:?}", result);
}