• 0
Milardov

Problem asking a question

Question

Hello,

 I'm trying to ask a question in a specific article using the PHP-SDK class. I'm already logged in ML and I have my access_token, but I get a 505 error. Here is the piece of code where I'm stucked at:

 

    $params = array(
      'text' => 'this is a test',
      'item_id' => 'MLAMYID'
    );
    $url = 'https://api.mercadolibre.com.ar/questions/?access_token='.$_SESSION['access_token'];
    echo var_dump($meli->post($url, null, $params));

 

 Any suggestions? is there something I'm doing wrong? maybe my curl configuration?

 Regards.

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hi, the curl for make a question should be:

curl -i -X POST -H "Content-Type: application/json" -d '{
"text":"Do you have these shoes in red?",
"item_id":"MLA123456"
}'
https://api.mercadolibre.com/questions/?access_token=$ACCESS_TOKEN

check the example of how make a post on the php-sdk: 

 

https://github.com/mercadolibre/php-sdk/blob/master/examples/example_list_item.php

 

something like this:

$questions = array( 
"text" => "Do you have these shoes in red?",
"item_id" => "MLA123456"
);

print_r($meli->post('/questions', $questions, array('access_token' => $token));

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...