Jump to content

Recommended Posts

Olá, estou realizando um get na api, ele me retorno o xml/estrutura mas sem dados dos produtos, segue em anexo.

Sendo que na tabela products temos 19 cadastros.

Alguém pode me ajudar? segue o código abaixo em delphi:

  var
    aNode, aCNode, aCCNode : IXMLNode;
    i,j : integer;
    aXml : string;
  begin
  Memo1.Lines.Clear;

  RESTRequest1.Params.Clear;
  RESTClient1.Authenticator := nil;
  SimpleAuthenticator1.UserNameKey := '';
  SimpleAuthenticator1.UserName := '';


  RESTClient1.BaseURL := EdBaseURL.Text;
  RESTRequest1.Resource := ComboBox1.Text;//' >> products ';
  RESTRequest1.ResourceSuffix := '?schema=blank&ws_key='+EdKey.Text;
  RESTRequest1.Method := TRESTRequestMethod.rmGET;
  RESTRequest1.Execute;
  aXml := RESTResponse1.Content;
  XMLDocument1.LoadFromXML(aXml);
 

retorno...

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<product>
    <id></id>
    <id_manufacturer></id_manufacturer>
    <id_supplier></id_supplier>
    <id_category_default></id_category_default>
    <new></new>
    <cache_default_attribute></cache_default_attribute>
    <id_default_image></id_default_image>
    <id_default_combination></id_default_combination>
    <id_tax_rules_group></id_tax_rules_group>
    <position_in_category></position_in_category>
    <type></type>
    <id_shop_default></id_shop_default>
    <reference></reference>
    <supplier_reference></supplier_reference>
    <location></location>
    <width></width>
    <height></height>
    <depth></depth>
    <weight></weight>
    <quantity_discount></quantity_discount>
    <ean13></ean13>
    <isbn></isbn>
    <upc></upc>
    <cache_is_pack></cache_is_pack>
    <cache_has_attachments></cache_has_attachments>
    <is_virtual></is_virtual>
    <state></state>
    <additional_delivery_times></additional_delivery_times>
    <delivery_in_stock><language id="2"></language></delivery_in_stock>
    <delivery_out_stock><language id="2"></language></delivery_out_stock>
    <on_sale></on_sale>
    <online_only></online_only>
    <ecotax></ecotax>
    <minimal_quantity></minimal_quantity>
    <low_stock_threshold></low_stock_threshold>
    <low_stock_alert></low_stock_alert>
    <price></price>
    <wholesale_price></wholesale_price>
    <unity></unity>
    <unit_price_ratio></unit_price_ratio>
    <additional_shipping_cost></additional_shipping_cost>
    <customizable></customizable>
    <text_fields></text_fields>
    <uploadable_files></uploadable_files>
    <active></active>
    <redirect_type></redirect_type>
    <id_type_redirected></id_type_redirected>
    <available_for_order></available_for_order>
    <available_date></available_date>
    <show_condition></show_condition>
    <condition></condition>
    <show_price></show_price>
    <indexed></indexed>
    <visibility></visibility>
    <advanced_stock_management></advanced_stock_management>
    <date_add></date_add>
    <date_upd></date_upd>
    <pack_stock_type></pack_stock_type>
    <meta_description><language id="2"></language></meta_description>
    <meta_keywords><language id="2"></language></meta_keywords>
    <meta_title><language id="2"></language></meta_title>
    <link_rewrite><language id="2"></language></link_rewrite>
    <name><language id="2"></language></name>
    <description><language id="2"></language></description>
    <description_short><language id="2"></language></description_short>
    <available_now><language id="2"></language></available_now>
    <available_later><language id="2"></language></available_later>
<associations>
<categories>
    <category>
    <id></id>
    </category>
</categories>
<images>
    <image>
    <id></id>
    </image>
</images>
<combinations>
    <combination>
    <id></id>
    </combination>
</combinations>
<product_option_values>
    <product_option_value>
    <id></id>
    </product_option_value>
</product_option_values>
<product_features>
    <product_feature>
    <id></id>
    <id_feature_value></id_feature_value>
    </product_feature>
</product_features>
<tags>
    <tag>
    <id></id>
    </tag>
</tags>
<stock_availables>
    <stock_available>
    <id></id>
    <id_product_attribute></id_product_attribute>
    </stock_available>
</stock_availables>
<accessories>
    <product>
    <id></id>
    </product>
</accessories>
<product_bundle>
    <product>
    <id></id>
    <quantity></quantity>
    </product>
</product_bundle>
</associations>
</product>
</prestashop>

 

 

Obrigado.

 

 

Share this post


Link to post
Share on other sites

Este é o XML de um produto específico (/api/product/$id_product).

O XML da lista de produtos (/api/products) é assim:

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<products>
<product id="1" xlink:href="https://sualoja.com.br/api/products/1"/>
<product id="2" xlink:href="https://sualoja.com.br/api/products/2"/>
<product id="3" xlink:href="https://sualoja.com.br/api/products/3"/>
</products>
</prestashop>

 

Share this post


Link to post
Share on other sites

Olá Daniel, sim eu preciso da lista de produtos,  (/api/products) estou usando assim mas não retorna o xml com a lista de produtos, apenas o resultado acima.

Sabe por que?

Obrigado.

Share this post


Link to post
Share on other sites
On 1/23/2019 at 4:04 PM, rodrigomarchiori said:

Olá Daniel, sim eu preciso da lista de produtos,  (/api/products) estou usando assim mas não retorna o xml com a lista de produtos, apenas o resultado acima.

Sabe por que?

Obrigado.

Provavelmente sua consulta está errada.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More