addPet
Add a new pet to the store
/pet
                                            
Usage and SDK Samples
curl -X post "http://petstore.swagger.io/v2/pet"
                                                
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import .PetApi;
import java.io.File;
import java.util.*;
public class PetApiExample {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        
        // Configure OAuth2 access token for authorization: petstore_auth
        OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
        petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
        PetApi apiInstance = new PetApi();
        Pet body = ; // Pet | Pet object that needs to be added to the store
        try {
            apiInstance.addPet(body);
        } catch (ApiException e) {
            System.err.println("Exception when calling PetApi#addPet");
            e.printStackTrace();
        }
    }
}
                                                  
          
import .PetApi;
public class PetApiExample {
    public static void main(String[] args) {
        PetApi apiInstance = new PetApi();
        Pet body = ; // Pet | Pet object that needs to be added to the store
        try {
            apiInstance.addPet(body);
        } catch (ApiException e) {
            System.err.println("Exception when calling PetApi#addPet");
            e.printStackTrace();
        }
    }
}
                                                  
          
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
Pet *body = ; // Pet object that needs to be added to the store
PetApi *apiInstance = [[PetApi alloc] init];
// Add a new pet to the store
[apiInstance addPetWith:body
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
                                                    
                                                
var  = require('');
var defaultClient = .ApiClient.instance;
// Configure OAuth2 access token for authorization: petstore_auth
var petstore_auth = defaultClient.authentications['petstore_auth'];
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
var api = new .PetApi()
var body = ; // {Pet} Pet object that needs to be added to the store
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.addPet(body, callback);
                                                    
                                                
using System;
using System.Diagnostics;
using .Api;
using .Client;
using ;
namespace Example
{
    public class addPetExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: petstore_auth
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
            var apiInstance = new PetApi();
            var body = new Pet(); // Pet | Pet object that needs to be added to the store
            try
            {
                // Add a new pet to the store
                apiInstance.addPet(body);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling PetApi.addPet: " + e.Message );
            }
        }
    }
}
                                                    
                                                
setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new io.swagger.client\Api\PetApi();
$body = ; // Pet | Pet object that needs to be added to the store
try {
    $api_instance->addPet($body);
} catch (Exception $e) {
    echo 'Exception when calling PetApi->addPet: ', $e->getMessage(), PHP_EOL;
}
                                                  
          Parameters
| Name | Description | 
|---|---|
| body * |