SEOshop Documentation

Resources

Resources are sources of specific information. Individual resources are identified in requests using URLs. Each resource represents a database record or a collection of database records. The format returned can be in JSON or XML.

Each resource will have implemented at least one request method (GET, POST, PUT, DELETE). Below are some examples using the products resource. Other resources work the same way unless a certain method is not implemented.

For a complete overview of all available resources, click here.

Retrieving information

Retrieving all products is done by doing a GET request to the products resource.

Example
$ curl https://api.webshopapp.com/en/products.json -u key:secret
Retrieve all products.

Request:
https://<api_key>:<api_token>@<cluster_url>/<shop_language>/products.json

PHP client example:

<?php
$products = $api->products->get();

Filter the results

While retrieving products you can apply extra GET parameters to filter the results. Available parameters are shown on the products resource page at the endpoints section.

Parameter examples:

  • page: Page for which you want to get the results (default: 1)
  • limit: Amount of products returned by the API (default: 50, maximum: 250)
  • since_id: Only return products with an identifier (ID) higher than the given value (default: 0)

Example
$ curl https://api.webshopapp.com/en/products.json?page=2&limit=100 -u key:secret
Retrieve page two of products with a maximum of 100 results.

Request:
https://<api_key>:<api_token>@<cluster_url>/<shop_language>/products.json?page=2&limit=100

PHP client example:

<?php
// The first parameter $productId can be ignored
$products = $api->products->get(null, array('page' => 2, 'limit' => 100));

Retrieve one product

Retrieving one product is done by appending the product identifier (ID) to the products resource URL.

Example
$ curl https://api.webshopapp.com/en/products/{product_id}.json -u key:secret
Retrieve a single product.

Request:
https://<api_key>:<api_token>@<cluster_url>/<shop_language>/products/<product_id>.json

PHP client example:

<?php
$productId = 123;

$product = $api->products->get($productId);

Retrieve the count

Retrieving the total amount of products is done by appending /count to the products resource URL. You can also apply the same GET parameters used for retrieving products.

Example
$ curl https://api.webshopapp.com/en/products/count.json -u key:secret
Retrieve the total number of products.

Request:
https://<api_key>:<api_token>@<cluster_url>/<shop_language>/products/count.json

PHP client example:

<?php
$count = $api->products->count();

Creating a product

Creating a product is done by doing a POST request to the products resource. After creating a product the API will automatically return an array with the product information including a unique product identifier (ID). For a complete overview of all possible parameters visit the products resource page.

Example
curl https://api.webshopapp.com/en/products.json \
  -u key:secret \
  -d product[title]="Lamswool scarf" \
  -d product[fulltitle]="Lamswool scarf by Siwy"
Create a new product

Request:
https://<api_key>:<api_token>@<cluster_url>/<shop_language>/products.json

PHP client example:

<?php
$parameters = array(
    'title' => 'My first product'
);

$product = $api->products->create($parameters);

Update a product

Updating a product is done by performing a PUT request to the products resource. After updating a product the API will automatically return the modified product information. The product identifier (ID) needs to be appended to the products resource URL. For a complete overview of all possible parameters visit the products resource page.

Example
curl https://api.webshopapp.com/en/products/{product_id}.json \
  -u key:secret \
  -X "PUT" \
  -d product[title]="Cotton scarf" \
  -d product[fulltitle]="Cotton scarf by Siwy"
Update an existing product

Request:
https://<api_key>:<api_token>@<cluster_url>/<shop_language>/products/<product_id>.json

PHP client example:

<?php
$productId = 123;

$parameters = array(
    'title' => 'My modified product'
);

$product = $api->products->update($productId, $parameters);

Deleting a product

Deleting a product is done by doing a DELETE request to the products resource. The product identifier (ID) needs to be appended to the products resource URL.

Example
curl https://api.webshopapp.com/en/products/{product_id}.json \
  -u key:secret \
  -X "DELETE"
Delete a product

Request:
https://<api_key>:<api_token>@<cluster_url>/<shop_language>/products/<product_id>.json

PHP client example:

<?php
$productId = 123;

$api->products->delete($productId);
Was this article helpful? Yes No
One moment please
Thanks for your feedback.