All URIs are relative to https://petstore.swagger.io/v2
Method | HTTP request | Description |
---|---|---|
deleteOrder | DELETE /store/order/{orderId} | Delete purchase order by ID |
getInventory | GET /store/inventory | Returns pet inventories by status |
getOrderById | GET /store/order/{orderId} | Find purchase order by ID |
placeOrder | POST /store/order | Place an order for a pet |
deleteOrder(orderId)
Delete purchase order by ID
For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors
// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.StoreApi;
StoreApi apiInstance = new StoreApi();
Long orderId = 789L; // Long | ID of the order that needs to be deleted
try {
apiInstance.deleteOrder(orderId);
} catch (ApiException e) {
System.err.println("Exception when calling StoreApi#deleteOrder");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
orderId | Long | ID of the order that needs to be deleted |
null (empty response body)
No authorization required
Map<String, Integer> getInventory()
Returns pet inventories by status
Returns a map of status codes to quantities
// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.StoreApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// 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");
StoreApi apiInstance = new StoreApi();
try {
Map<String, Integer> result = apiInstance.getInventory();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling StoreApi#getInventory");
e.printStackTrace();
}
This endpoint does not need any parameter.
Order getOrderById(orderId)
Find purchase order by ID
For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions
// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.StoreApi;
StoreApi apiInstance = new StoreApi();
Long orderId = 789L; // 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 StoreApi#getOrderById");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
orderId | Long | ID of pet that needs to be fetched |
No authorization required
Order placeOrder(body)
Place an order for a pet
// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.StoreApi;
StoreApi apiInstance = new StoreApi();
Order body = new Order(); // Order | order placed for purchasing the pet
try {
Order result = apiInstance.placeOrder(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling StoreApi#placeOrder");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
body | Order | order placed for purchasing the pet |
No authorization required
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。