Jump to content

Web service filter category based on Language


jijo009

Recommended Posts

Hi all ,

 

This is my post in forum , i would like to know is there is any option to filter web service out put for category listing based on language id , below is my current xml out put.

 

GET /itart/api/categories/4 HTTP/1.1

Authorization: Basic

Host: 192.168.1.41

Accept: */*

 

 

RETURN

 

HTTP/1.1 200 OK

Date: Wed, 13 Jun 2012 13:20:13 GMT

Server: Apache/2.2.14 (Ubuntu)

X-Powered-By: PrestaShop Webservice

Access-Time: 1339593613

PSWS-Version: 1.4.8.2

Execution-Time: 0.005

Content-Sha1:

Vary: Accept-Encoding

Content-Length: 4838

Content-Type: text/xml;charset=utf-8

 

HTTP RETURN

 

<?xml version="1.0" encoding="UTF-8"?>

<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">

<category>

<id><![CDATA[4]]></id>

<id_parent xlink:href="http://192.168.1.41/itart/api/categories/1"><![CDATA[1]]></id_parent>

<level_depth readonly="true"><![CDATA[1]]></level_depth>

<nb_products_recursive not_filterable="true" readonly="true"><![CDATA[2]]></nb_products_recursive>

<active><![CDATA[1]]></active>

<name><language id="1" xlink:href="http://192.168.1.41/itart/api/languages/1"><![CDATA[Laptops]]></language><language id="2" xlink:href="http://192.168.1.41/itart/api/languages/2"><![CDATA[Portables]]></language><language id="3" xlink:href="http://192.168.1.41/itart/api/languages/3"><![CDATA[Portátiles]]></language><language id="5" xlink:href="http://192.168.1.41/itart/api/languages/5"><![CDATA[Laptop]]></language></name>

<link_rewrite><language id="1" xlink:href="http://192.168.1.41/itart/api/languages/1"><![CDATA[laptops]]></language><language id="2" xlink:href="http://192.168.1.41/itart/api/languages/2"><![CDATA[portables-apple]]></language><language id="3" xlink:href="http://192.168.1.41/itart/api/languages/3"><![CDATA[portatiles-apple]]></language><language id="5" xlink:href="http://192.168.1.41/itart/api/languages/5"><![CDATA[laptop]]></language></link_rewrite>

<meta_title><language id="1" xlink:href="http://192.168.1.41/itart/api/languages/1"><![CDATA[Apple laptops]]></language><language id="2" xlink:href="http://192.168.1.41/itart/api/languages/2"><![CDATA[Portables Apple]]></language><language id="3" xlink:href="http://192.168.1.41/itart/api/languages/3"><![CDATA[Portátiles Apple]]></language><language id="5" xlink:href="http://192.168.1.41/itart/api/languages/5"><![CDATA[laptop Apple]]></language></meta_title>

<meta_description><language id="1" xlink:href="http://192.168.1.41/itart/api/languages/1"><![CDATA[Powerful and chic Apple laptops]]></language><language id="2" xlink:href="http://192.168.1.41/itart/api/languages/2"><![CDATA[portables apple puissants et design]]></language><language id="3" xlink:href="http://192.168.1.41/itart/api/languages/3"><![CDATA[portátiles apple poderoso y el diseño]]></language><language id="5" xlink:href="http://192.168.1.41/itart/api/languages/5"><![CDATA[Laptop Apple potenti ed eleganti]]></language></meta_description>

<meta_keywords><language id="1" xlink:href="http://192.168.1.41/itart/api/languages/1"><![CDATA[Apple laptops MacBook Air]]></language><language id="2" xlink:href="http://192.168.1.41/itart/api/languages/2"><![CDATA[portables apple macbook air]]></language><language id="3" xlink:href="http://192.168.1.41/itart/api/languages/3"><![CDATA[portátiles apple macbook air]]></language><language id="5" xlink:href="http://192.168.1.41/itart/api/languages/5"><![CDATA[laptot Apple MacBook Air]]></language></meta_keywords>

<description><language id="1" xlink:href="http://192.168.1.41/itart/api/languages/1"><![CDATA[The latest Intel processor, a bigger hard drive, plenty of memory, and even more new features all fit inside just one liberating inch. The new Mac laptops have the performance, power, and connectivity of a desktop computer. Without the desk part.]]></language><language id="2" xlink:href="http://192.168.1.41/itart/api/languages/2"><![CDATA[Le tout dernier processeur Intel, un disque dur plus spacieux, de la mémoire à profusion et d'autres nouveautés. Le tout, dans à peine 2,59 cm qui vous libèrent de toute entrave. Les nouveaux portables Mac réunissent les performances, la puissance et la connectivité d'un ordinateur de bureau. Sans la partie bureau.]]></language><language id="3" xlink:href="http://192.168.1.41/itart/api/languages/3"><![CDATA[El último procesador Intel, un disco duro más grande, con profusión de memoria y otras novedades. Todo en sólo 2,59 cm libres de cualquier obstrucción. Las nuevas portátiles Mac cumplir rendimiento, potencia y conectividad de una computadora de escritorio. Sin la parte del escritorio.]]></language><language id="5" xlink:href="http://192.168.1.41/itart/api/languages/5"><![CDATA[L'ultimissimo processore Intel, hard drive più ampio, moltissima memoria, e ancora più funzioni tutte inserite in 2,54 centimetri. I nuovi laptop Mac offrono le prestazioni, la potenza e la connettività di un computer da tavolo. Senza bisogno del tavolo.]]></language></description>

<date_add readonly="true"><![CDATA[2012-06-07 14:40:49]]></date_add>

<date_upd readonly="true"><![CDATA[2012-06-07 14:40:49]]></date_upd>

<associations>

<categories node_type="category"/>

<products node_type="product">

<product xlink:href="http://192.168.1.41/itart/api/products/5">

<id><![CDATA[5]]></id>

</product>

<product xlink:href="http://192.168.1.41/itart/api/products/6">

<id><![CDATA[6]]></id>

</product>

</products>

</associations>

</category>

</prestashop>

 

Thanks in advance.

 

Jijomon

Link to comment
Share on other sites

  • 1 year later...
  • 4 years later...
  • 2 years later...

@anuj.anuj555 in PS 1.7 you can include a filter to language you want retrieve. Something like this:

$xml = $webService->get(array('resource' => 'products', 'display'=> 'full', 'language'=>'id_language'));

I test it and it is working for me in this format: base_url/api/resource/?display=[value]&languaje=[id_language]

 

Link to comment
Share on other sites

  • 11 months later...

/prestashop/api/categories?language=1&output_format=JSON&display=full gives below

active: "1"
associations: {products: Array(1)}
date_add: "2021-03-17 10:21:48"
date_upd: "2021-03-17 10:21:48"
description: null
id: 4
id_parent: "3"
id_shop_default: "1"
is_root_category: "0"
level_depth: "3"
link_rewrite: null
meta_description: null
meta_keywords: null
meta_title: null
name: null
nb_products_recursive: "1"
position: "0"

here name is null. how to fix it?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...