9.3 KiB
SwaggerPetstore.StoreApi
All URIs are relative to http://petstore.swagger.io/v2
Method | HTTP request | Description |
---|---|---|
deleteOrder | DELETE /store/order/{orderId} | Delete purchase order by ID |
findOrdersByStatus | GET /store/findByStatus | Finds orders by status |
getInventory | GET /store/inventory | Returns pet inventories by status |
getInventoryInObject | GET /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' |
getOrderById | GET /store/order/{orderId} | Find purchase order by ID |
placeOrder | POST /store/order | Place an order for a pet |
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
var SwaggerPetstore = require('swagger-petstore');
var apiInstance = new SwaggerPetstore.StoreApi()
var orderId = "orderId_example"; // {String} ID of the order that needs to be deleted
apiInstance.deleteOrder(orderId).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
});
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: application/json, application/xml
findOrdersByStatus
[Order] findOrdersByStatus(opts)
Finds orders by status
A single status value can be provided as a string
Example
var SwaggerPetstore = require('swagger-petstore');
var defaultClient = SwaggerPetstore.ApiClient.default;
// Configure API key authorization: test_api_client_id
var test_api_client_id = defaultClient.authentications['test_api_client_id'];
test_api_client_id.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//test_api_client_id.apiKeyPrefix['x-test_api_client_id'] = "Token"
// Configure API key authorization: test_api_client_secret
var test_api_client_secret = defaultClient.authentications['test_api_client_secret'];
test_api_client_secret.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token"
var apiInstance = new SwaggerPetstore.StoreApi()
var opts = {
'status': "placed" // {String} Status value that needs to be considered for query
};
apiInstance.findOrdersByStatus(opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
status | String | Status value that needs to be considered for query | [optional] [default to placed] |
Return type
Authorization
test_api_client_id, test_api_client_secret
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, application/xml
getInventory
{'String': 'Integer'} getInventory
Returns pet inventories by status
Returns a map of status codes to quantities
Example
var SwaggerPetstore = require('swagger-petstore');
var defaultClient = SwaggerPetstore.ApiClient.default;
// Configure API key authorization: api_key
var api_key = defaultClient.authentications['api_key'];
api_key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix['api_key'] = "Token"
var apiInstance = new SwaggerPetstore.StoreApi()
apiInstance.getInventory().then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
Parameters
This endpoint does not need any parameter.
Return type
{'String': 'Integer'}
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, application/xml
getInventoryInObject
Object getInventoryInObject
Fake endpoint to test arbitrary object return by 'Get inventory'
Returns an arbitrary object which is actually a map of status codes to quantities
Example
var SwaggerPetstore = require('swagger-petstore');
var defaultClient = SwaggerPetstore.ApiClient.default;
// Configure API key authorization: api_key
var api_key = defaultClient.authentications['api_key'];
api_key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix['api_key'] = "Token"
var apiInstance = new SwaggerPetstore.StoreApi()
apiInstance.getInventoryInObject().then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
Parameters
This endpoint does not need any parameter.
Return type
Object
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, application/xml
getOrderById
Order getOrderById(orderId)
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
Example
var SwaggerPetstore = require('swagger-petstore');
var defaultClient = SwaggerPetstore.ApiClient.default;
// Configure API key authorization: test_api_key_header
var test_api_key_header = defaultClient.authentications['test_api_key_header'];
test_api_key_header.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//test_api_key_header.apiKeyPrefix['test_api_key_header'] = "Token"
// Configure API key authorization: test_api_key_query
var test_api_key_query = defaultClient.authentications['test_api_key_query'];
test_api_key_query.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//test_api_key_query.apiKeyPrefix['test_api_key_query'] = "Token"
var apiInstance = new SwaggerPetstore.StoreApi()
var orderId = "orderId_example"; // {String} ID of pet that needs to be fetched
apiInstance.getOrderById(orderId).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
orderId | String | ID of pet that needs to be fetched |
Return type
Authorization
test_api_key_header, test_api_key_query
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, application/xml
placeOrder
Order placeOrder(opts)
Place an order for a pet
Example
var SwaggerPetstore = require('swagger-petstore');
var defaultClient = SwaggerPetstore.ApiClient.default;
// Configure API key authorization: test_api_client_id
var test_api_client_id = defaultClient.authentications['test_api_client_id'];
test_api_client_id.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//test_api_client_id.apiKeyPrefix['x-test_api_client_id'] = "Token"
// Configure API key authorization: test_api_client_secret
var test_api_client_secret = defaultClient.authentications['test_api_client_secret'];
test_api_client_secret.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token"
var apiInstance = new SwaggerPetstore.StoreApi()
var opts = {
'body': new SwaggerPetstore.Order() // {Order} order placed for purchasing the pet
};
apiInstance.placeOrder(opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
body | Order | order placed for purchasing the pet | [optional] |
Return type
Authorization
test_api_client_id, test_api_client_secret
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, application/xml