# HivelocityApi.InventoryApi

All URIs are relative to *https://localhost/api/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
[**getLocationResource**](InventoryApi.md#getLocationResource) | **GET** /inventory/locations | Return sps facilities and locations
[**getStockByProductResource**](InventoryApi.md#getStockByProductResource) | **GET** /inventory/product/{productId} | Return a structured sps stock data, grouped by city or facility code for a single product
[**getStockResource**](InventoryApi.md#getStockResource) | **GET** /inventory/product | Return structured sps stock data, grouped by city or facility code for all products


<a name="getLocationResource"></a>
# **getLocationResource**
> [Location] getLocationResource(opts)

Return sps facilities and locations

### Example
```javascript
var HivelocityApi = require('hivelocity_api');
var defaultClient = HivelocityApi.ApiClient.instance;

// Configure API key authorization: apiKey
var apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

var apiInstance = new HivelocityApi.InventoryApi();

var opts = { 
  'xFields': "xFields_example" // String | An optional fields mask
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getLocationResource(opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **xFields** | **String**| An optional fields mask | [optional] 

### Return type

[**[Location]**](Location.md)

### Authorization

[apiKey](../README.md#apiKey)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="getStockByProductResource"></a>
# **getStockByProductResource**
> Stock getStockByProductResource(productId, opts)

Return a structured sps stock data, grouped by city or facility code for a single product

### Example
```javascript
var HivelocityApi = require('hivelocity_api');
var defaultClient = HivelocityApi.ApiClient.instance;

// Configure API key authorization: apiKey
var apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

var apiInstance = new HivelocityApi.InventoryApi();

var productId = 56; // Number | Product database ID

var opts = { 
  'xFields': "xFields_example" // String | An optional fields mask
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getStockByProductResource(productId, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **productId** | **Number**| Product database ID | 
 **xFields** | **String**| An optional fields mask | [optional] 

### Return type

[**Stock**](Stock.md)

### Authorization

[apiKey](../README.md#apiKey)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="getStockResource"></a>
# **getStockResource**
> Inventory getStockResource(opts)

Return structured sps stock data, grouped by city or facility code for all products

### Example
```javascript
var HivelocityApi = require('hivelocity_api');
var defaultClient = HivelocityApi.ApiClient.instance;

// Configure API key authorization: apiKey
var apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

var apiInstance = new HivelocityApi.InventoryApi();

var opts = { 
  'location': "MAIN", // String | Filter products by location
  'groupBy': "facility" // String | Get results grouped by 'city', 'facility', or 'flat'
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getStockResource(opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **location** | **String**| Filter products by location | [optional] [default to MAIN]
 **groupBy** | **String**| Get results grouped by 'city', 'facility', or 'flat' | [optional] [default to facility]

### Return type

[**Inventory**](Inventory.md)

### Authorization

[apiKey](../README.md#apiKey)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

