• 0
Sign in to follow this  
FSoler

Publicar respuestas con SDK .Net

Question

Hola:

 

Estoy tratando de publicar una respuesta con el sdk .net, con el siguiente código:

 

Meli meli = new Meli("ID App", "Secret", "AccessToken", "RefreshToken");
 
 p = new Parameter();
 p.Name = "access_token";
 p.Value = meli.AccessToken;
 ps.Add(p);
 
 p = new Parameter();
 p.Name = "question_id";
 p.Value = "4048308205";
 ps.Add(p);
 
 p = new Parameter();
 p.Name = "text";
 p.Value = "Estoy saliendo por codigo";
 ps.Add(p);
            
 var r = meli.Post("/answers", ps, new { foo = "bar" });
 
Y me da el siguiente resultado erróneo:
 
{"message":"Invalid JSON. Valid attributes are: [question_id, text].","error":"invalid_post_body","status":400,"cause":[]}
 
Saben cual es la causa?
 
Muchas gracias

 

 

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Esta es la solución:

 

Parameter p;
List<Parameter> ps = new List<Parameter>();
 
Meli meli = new Meli("ID App", "Secret", "AccessToken", "RefreshToken");
 
p = new Parameter();
p.Name = "access_token";
p.Value = meli.AccessToken;
ps.Add(p);
 
var r = meli.Post("/answers", ps, new { question_id = "4048308205", text = "Estoy saliendo por codigo" });

Share this post


Link to post
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
Sign in to follow this