Retrieve Articles and Category using REST Api in Shopware

If you have api key and already create rest api. Then follow these steps to retrieve data using rest api.

Get articles and category using REST Api

  • Create a page getdata.php
  • put following code and run this code.
For Article:

If you want to search an article by Article Id:
<?php
include 'config.php';
$client->get('articles/ARTICLE_ID');  //Replace ARTICLE_ID with an article id for search
?>
If you want to search an article by Order Number:

<?php
include 'config.php';
$client->get('articles/ORDER_NUMBER?useNumberAsId=1');  //Replace ORDER_NUMBER with an article order number for search
?>
If you want to search all articles:

<?php
include 'config.php';
$client->get('articles'); 
?>
For Category:

If you want to search a category by category id:
<?php
include 'config.php';
$client->get('categories/CATEGORY_ID');  //Replace CATEGORY_ID with an article id for search
?>

If you want to search all categories:

<?php
include 'config.php';
$client->get('categories'); 
?>

  •  Thats it. Run this script and you will get your result.
Next Post: Update Data using REST Api in Shopware
1 Comments
Disqus
Fb Comments
Comments :

1 comment:

  1. Thank your very much for your examples.
    Exactly these I am missing at the shopware site.

    ReplyDelete