# ProductService
To use this service, you need a sessionId from the Authenticate Service under the api.24sevenoffice.com domain.
This service is used to retrieve and save information about products. A product always belongs to a category, so in order to save a new product you need to know which category it should belong to. You can get a complete list of categories by invoking the GetCategories (opens new window) method.
ProductService (opens new window)
ProductService WSDL (opens new window)
# Guides
# Save Products
The minimum required properties for saving a new product are CategoryId and Name as a request to SaveProducts (opens new window), but you will typically want to include more properties.
Below is a simple XML example for a request to the SaveProducts (opens new window) method:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SaveProducts xmlns="http://24sevenOffice.com/webservices">
<products>
<Product>
<Name>TestProduct</Name>
<CategoryId>1</CategoryId>
</Product>
</products>
</SaveProducts>
</soap:Body>
</soap:Envelope>
# Retrieve Products
To retrieve products you need to use the GetProducts (opens new window) method. Remember that you need to specify the what in the returnProperties you want to retrieve.
Example of a request:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetProducts xmlns="http://24sevenOffice.com/webservices">
<searchParams>
<Id>1000</Id>
<CategoryId>4</CategoryId>
</searchParams>
<returnProperties>
<string>Name</string>
<string>Price</string>
</returnProperties>
</GetProducts>
</soap:Body>
</soap:Envelope>
# Delete Products
To delete products you need to use the DeleteProducts (opens new window) method.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<DeleteProducts xmlns="http://24sevenOffice.com/webservices">
<products>
<Product>
<Id>1000</Id>
</Product>
</products>
</DeleteProducts>
</soap:Body>
</soap:Envelope>
# Create Categories
To create a category you need to use the SaveCategories (opens new window) mathod. You can add multiple categories in the request. If you want to update a category you will need to use the Id property.
Example of a request:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SaveCategories xmlns="http://24sevenOffice.com/webservices">
<categories>
<Category>
<Name>Test Category</Name>
</Category>
</categories>
</SaveCategories>
</soap:Body>
</soap:Envelope>
# Retrieve Categories
To retrieve the categories you need to use the GetCategories (opens new window) method. It will return an array of categories. Please note that you need to specify the return properties.
Example of a request:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetCategories xmlns="http://24sevenOffice.com/webservices">
<returnProperties>
<string>Name</string>
<string>Id</string>
</returnProperties>
</GetCategories>
</soap:Body>
</soap:Envelope>
# Set Stock Quantity
To set the stock quantity of a product you need to use the SetStockQuantity (opens new window) method. The response returns true if no error occured.
Example of a request:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SetStockQuantity xmlns="http://24sevenOffice.com/webservices">
<productId>1000</productId>
<stockQuantity>10</stockQuantity>
</SetStockQuantity>
</soap:Body>
</soap:Envelope>
# Retrieve Matrix Price Groups
Use the GetDiscountMatrixPriceGroup (opens new window) method to retrieve the matrix price group. Retrives an array of Discount[] which includes the PriceGroupId, CategorId and the value.
Example of a request:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetDiscountMatrixPriceGroup xmlns="http://24sevenOffice.com/webservices" />
</soap:Body>
</soap:Envelope>
# Retrieve Discount Matrix Categories
Retrieves an array of Discount[] which includes categoryId, customerId and the value.
Example of a request:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetDiscountMatrixCategory xmlns="http://24sevenOffice.com/webservices" />
</soap:Body>
</soap:Envelope>
# Retrieve Price List
To retrieve the price list you need to use the GetPriceList (opens new window) method. It takes a PriceListId integer as input in the request. It returns a list of KeyValuePairs. The Key is the ProductId and the Value is the Price from the corresponding price list ID that was set in the request.
In the example below you would get a list of all products and their price set for the PriceListId 2. In 24SevenOffice PriceListId 1 and 2 exist by default. Any subsequent PriceLists are customer created price lists.
PriceListId 1 is the standard Price of a product, and PriceListId 2 is called "Price 2".
Example of a request:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetPriceList xmlns="http://24sevenOffice.com/webservices">
<priceListId>2</priceListId>
</GetPriceList>
</soap:Body>
</soap:Envelope>
# Retrieve All Price Lists
The method GetAllPriceLists (opens new window) retrives all the price lists. The Id returned can be used by the method GetPriceList (opens new window) to retrive the specified price list.
Example of a request:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetAllPriceLists xmlns="http://24sevenOffice.com/webservices" />
</soap:Body>
</soap:Envelope>
# Methods
Method | Input type | Return type | Description |
---|---|---|---|
GetProducts (opens new window) | ProductSearchParameters, returnProperties[] | Product[] | Returns a list of products based on the given search parameters. Will only return the properties specified in the returnProperties parameter. |
SaveProducts (opens new window) | Product[] | Product[] | Saves a list of products |
DeleteProducts (opens new window) | Product[] | Product[] | Deletes a list of products |
GetCategories (opens new window) | returnProperties[] | Category[] | Returns a list of categories with the return properties specified. |
SaveCategories (opens new window) | Category[] | Category[] | Saves a list of categories |
SetStockQuantity (opens new window) | productId(Int32), stockQuantity(Decimal) | Boolean | Sets the stock quantity and returns true if no error occured. |
GetDiscountMatrixPriceGroup (opens new window) | - | Discount[] | |
GetDiscountMatrixCategory (opens new window) | - | Discount[] | |
GetPriceList (opens new window) | priceListId(Int32) | KeyValuePair[] | Returns a KeyValuePair array of ProductIDs and Prices that match the specified PriceListId. Key = ProductId, Value = Price |
GetAllPriceLists (opens new window) | - | ProductPriceList[] | Returns a list of product price list data |