# CommonApi All URIs are relative to *http://petstore.swagger.io/v2* | Method | HTTP request | Description | |------------- | ------------- | -------------| | [**addPet**](CommonApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**createUser**](CommonApi.md#createUser) | **POST** /user | Create user | | [**createUsersWithArrayInput**](CommonApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | | [**createUsersWithListInput**](CommonApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | | [**deleteOrder**](CommonApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID | | [**deletePet**](CommonApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | | [**deleteUser**](CommonApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | | [**findPetsByStatus**](CommonApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](CommonApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getInventory**](CommonApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | | [**getOrderById**](CommonApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID | | [**getPetById**](CommonApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | | [**getUserByName**](CommonApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | | [**loginUser**](CommonApi.md#loginUser) | **GET** /user/login | Logs user into the system | | [**logoutUser**](CommonApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | | [**placeOrder**](CommonApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | | [**updatePet**](CommonApi.md#updatePet) | **PUT** /pet | Update an existing pet | | [**updatePetWithForm**](CommonApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | | [**updateUser**](CommonApi.md#updateUser) | **PUT** /user/{username} | Updated user | | [**uploadFile**](CommonApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | # **addPet** > Pet addPet(pet) Add a new pet to the store ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); CommonApi apiInstance = new CommonApi(defaultClient); Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { Pet result = apiInstance.addPet(pet); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#addPet"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | ### Return type [**Pet**](Pet.md) ### Authorization [petstore_auth](../README.md#petstore_auth) ### HTTP request headers - **Content-Type**: application/json, application/xml - **Accept**: application/xml, application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **200** | successful operation | - | | **405** | Invalid input | - | # **createUser** > createUser(user) Create user This can only be done by the logged in user. ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); // Configure API key authorization: api_key ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); api_key.setApiKey("YOUR API KEY"); // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //api_key.setApiKeyPrefix("Token"); CommonApi apiInstance = new CommonApi(defaultClient); User user = new User(); // User | Created user object try { apiInstance.createUser(user); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#createUser"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **user** | [**User**](User.md)| Created user object | | ### Return type null (empty response body) ### Authorization [api_key](../README.md#api_key) ### HTTP request headers - **Content-Type**: application/json - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **0** | successful operation | - | # **createUsersWithArrayInput** > createUsersWithArrayInput(user) Creates list of users with given input array ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); // Configure API key authorization: api_key ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); api_key.setApiKey("YOUR API KEY"); // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //api_key.setApiKeyPrefix("Token"); CommonApi apiInstance = new CommonApi(defaultClient); List user = Arrays.asList(); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#createUsersWithArrayInput"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **user** | [**List<User>**](User.md)| List of user object | | ### Return type null (empty response body) ### Authorization [api_key](../README.md#api_key) ### HTTP request headers - **Content-Type**: application/json - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **0** | successful operation | - | # **createUsersWithListInput** > createUsersWithListInput(user) Creates list of users with given input array ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); // Configure API key authorization: api_key ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); api_key.setApiKey("YOUR API KEY"); // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //api_key.setApiKeyPrefix("Token"); CommonApi apiInstance = new CommonApi(defaultClient); List user = Arrays.asList(); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#createUsersWithListInput"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **user** | [**List<User>**](User.md)| List of user object | | ### Return type null (empty response body) ### Authorization [api_key](../README.md#api_key) ### HTTP request headers - **Content-Type**: application/json - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **0** | successful operation | - | # **deleteOrder** > deleteOrder(orderId) Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); CommonApi apiInstance = new CommonApi(defaultClient); String orderId = "orderId_example"; // String | ID of the order that needs to be deleted try { apiInstance.deleteOrder(orderId); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#deleteOrder"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **orderId** | **String**| ID of the order that needs to be deleted | | ### Return type null (empty response body) ### Authorization No authorization required ### HTTP request headers - **Content-Type**: Not defined - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **400** | Invalid ID supplied | - | | **404** | Order not found | - | # **deletePet** > deletePet(petId, apiKey) Deletes a pet ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); CommonApi apiInstance = new CommonApi(defaultClient); Long petId = 56L; // Long | Pet id to delete String apiKey = "apiKey_example"; // String | try { apiInstance.deletePet(petId, apiKey); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#deletePet"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **petId** | **Long**| Pet id to delete | | | **apiKey** | **String**| | [optional] | ### Return type null (empty response body) ### Authorization [petstore_auth](../README.md#petstore_auth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **400** | Invalid pet value | - | # **deleteUser** > deleteUser(username) Delete user This can only be done by the logged in user. ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); // Configure API key authorization: api_key ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); api_key.setApiKey("YOUR API KEY"); // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //api_key.setApiKeyPrefix("Token"); CommonApi apiInstance = new CommonApi(defaultClient); String username = "username_example"; // String | The name that needs to be deleted try { apiInstance.deleteUser(username); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#deleteUser"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **username** | **String**| The name that needs to be deleted | | ### Return type null (empty response body) ### Authorization [api_key](../README.md#api_key) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **400** | Invalid username supplied | - | | **404** | User not found | - | # **findPetsByStatus** > List<Pet> findPetsByStatus(status) Finds Pets by status Multiple status values can be provided with comma separated strings ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); CommonApi apiInstance = new CommonApi(defaultClient); List status = Arrays.asList("available"); // List | Status values that need to be considered for filter try { List result = apiInstance.findPetsByStatus(status); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#findPetsByStatus"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | ### Return type [**List<Pet>**](Pet.md) ### Authorization [petstore_auth](../README.md#petstore_auth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid status value | - | # **findPetsByTags** > List<Pet> findPetsByTags(tags) Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); CommonApi apiInstance = new CommonApi(defaultClient); List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#findPetsByTags"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **tags** | [**List<String>**](String.md)| Tags to filter by | | ### Return type [**List<Pet>**](Pet.md) ### Authorization [petstore_auth](../README.md#petstore_auth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid tag value | - | # **getInventory** > Map<String, Integer> getInventory() Returns pet inventories by status Returns a map of status codes to quantities ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); // Configure API key authorization: api_key ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); api_key.setApiKey("YOUR API KEY"); // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //api_key.setApiKeyPrefix("Token"); CommonApi apiInstance = new CommonApi(defaultClient); try { Map result = apiInstance.getInventory(); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#getInventory"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters This endpoint does not need any parameter. ### Return type **Map<String, Integer>** ### Authorization [api_key](../README.md#api_key) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **200** | successful operation | - | # **getOrderById** > Order getOrderById(orderId) Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); CommonApi apiInstance = new CommonApi(defaultClient); Long orderId = 56L; // Long | ID of pet that needs to be fetched try { Order result = apiInstance.getOrderById(orderId); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#getOrderById"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **orderId** | **Long**| ID of pet that needs to be fetched | | ### Return type [**Order**](Order.md) ### Authorization No authorization required ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid ID supplied | - | | **404** | Order not found | - | # **getPetById** > Pet getPetById(petId) Find pet by ID Returns a single pet ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); // Configure API key authorization: api_key ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); api_key.setApiKey("YOUR API KEY"); // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //api_key.setApiKeyPrefix("Token"); CommonApi apiInstance = new CommonApi(defaultClient); Long petId = 56L; // Long | ID of pet to return try { Pet result = apiInstance.getPetById(petId); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#getPetById"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **petId** | **Long**| ID of pet to return | | ### Return type [**Pet**](Pet.md) ### Authorization [api_key](../README.md#api_key) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid ID supplied | - | | **404** | Pet not found | - | # **getUserByName** > User getUserByName(username) Get user by user name ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); CommonApi apiInstance = new CommonApi(defaultClient); String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. try { User result = apiInstance.getUserByName(username); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#getUserByName"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | ### Return type [**User**](User.md) ### Authorization No authorization required ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid username supplied | - | | **404** | User not found | - | # **loginUser** > String loginUser(username, password) Logs user into the system ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); CommonApi apiInstance = new CommonApi(defaultClient); String username = "username_example"; // String | The user name for login String password = "password_example"; // String | The password for login in clear text try { String result = apiInstance.loginUser(username, password); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#loginUser"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **username** | **String**| The user name for login | | | **password** | **String**| The password for login in clear text | | ### Return type **String** ### Authorization No authorization required ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| | **400** | Invalid username/password supplied | - | # **logoutUser** > logoutUser() Logs out current logged in user session ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); // Configure API key authorization: api_key ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); api_key.setApiKey("YOUR API KEY"); // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //api_key.setApiKeyPrefix("Token"); CommonApi apiInstance = new CommonApi(defaultClient); try { apiInstance.logoutUser(); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#logoutUser"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters This endpoint does not need any parameter. ### Return type null (empty response body) ### Authorization [api_key](../README.md#api_key) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **0** | successful operation | - | # **placeOrder** > Order placeOrder(order) Place an order for a pet ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); CommonApi apiInstance = new CommonApi(defaultClient); Order order = new Order(); // Order | order placed for purchasing the pet try { Order result = apiInstance.placeOrder(order); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#placeOrder"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **order** | [**Order**](Order.md)| order placed for purchasing the pet | | ### Return type [**Order**](Order.md) ### Authorization No authorization required ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/xml, application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid Order | - | # **updatePet** > Pet updatePet(pet) Update an existing pet ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); CommonApi apiInstance = new CommonApi(defaultClient); Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { Pet result = apiInstance.updatePet(pet); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#updatePet"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | ### Return type [**Pet**](Pet.md) ### Authorization [petstore_auth](../README.md#petstore_auth) ### HTTP request headers - **Content-Type**: application/json, application/xml - **Accept**: application/xml, application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **200** | successful operation | - | | **400** | Invalid ID supplied | - | | **404** | Pet not found | - | | **405** | Validation exception | - | # **updatePetWithForm** > updatePetWithForm(petId, name, status) Updates a pet in the store with form data ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); CommonApi apiInstance = new CommonApi(defaultClient); Long petId = 56L; // Long | ID of pet that needs to be updated String name = "name_example"; // String | Updated name of the pet String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#updatePetWithForm"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **petId** | **Long**| ID of pet that needs to be updated | | | **name** | **String**| Updated name of the pet | [optional] | | **status** | **String**| Updated status of the pet | [optional] | ### Return type null (empty response body) ### Authorization [petstore_auth](../README.md#petstore_auth) ### HTTP request headers - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **405** | Invalid input | - | # **updateUser** > updateUser(username, user) Updated user This can only be done by the logged in user. ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); // Configure API key authorization: api_key ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); api_key.setApiKey("YOUR API KEY"); // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //api_key.setApiKeyPrefix("Token"); CommonApi apiInstance = new CommonApi(defaultClient); String username = "username_example"; // String | name that need to be deleted User user = new User(); // User | Updated user object try { apiInstance.updateUser(username, user); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#updateUser"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **username** | **String**| name that need to be deleted | | | **user** | [**User**](User.md)| Updated user object | | ### Return type null (empty response body) ### Authorization [api_key](../README.md#api_key) ### HTTP request headers - **Content-Type**: application/json - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **400** | Invalid user supplied | - | | **404** | User not found | - | # **uploadFile** > ModelApiResponse uploadFile(petId, additionalMetadata, _file) uploads an image ### Example ```java // Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.CommonApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); CommonApi apiInstance = new CommonApi(defaultClient); Long petId = 56L; // Long | ID of pet to update String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server File _file = new File("/path/to/file"); // File | file to upload try { ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, _file); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling CommonApi#uploadFile"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } } ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **petId** | **Long**| ID of pet to update | | | **additionalMetadata** | **String**| Additional data to pass to server | [optional] | | **_file** | **File**| file to upload | [optional] | ### Return type [**ModelApiResponse**](ModelApiResponse.md) ### Authorization [petstore_auth](../README.md#petstore_auth) ### HTTP request headers - **Content-Type**: multipart/form-data - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **200** | successful operation | - |