Click here to Skip to main content
15,915,600 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, i have some trouble consuming a web api, i try some diferents formats for call but im stil getting errors (error code 406)

C#
This is my code 

  protected void Button1_Click(object sender, EventArgs e)
    {
        var client = new RestClient("http://api.meaningcloud.com/class-1.1");
        var request = new RestRequest(Method.POST);
        request.AddHeader("content-type", "application/x-www-form-urlencoded");
        request.AddParameter("application/x-www-form-urlencoded", "key=MY_KEY_VALUE1b&txt=PRUEBA&model=IPTC_es", ParameterType.RequestBody);
        IRestResponse response = client.Execute(request);
        txtRespuesta.Text = response.Content;
    }


This is the response


<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>406 Not Acceptable</title>
</head><body>
<h1>Not Acceptable</h1>
<p>An appropriate representation of the requested resource /class-1.1 could not be found on this server.</p>
Available variants:
<ul>
<li><a href="class-1.1.php">class-1.1.php</a> , type application/x-httpd-php</li>
</ul>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at api.meaningcloud.com Port 80</address>
</body></html>


Any idea what im doing wrong?

Thanks for your time

What I have tried:

I try change the method for the response.</hr>
Posted
Updated 14-May-16 17:32pm

1 solution

You do know that meaning cloud has a support page, right?
Support | MeaningCloud[^]
They are experts on this so why not try to post your question there?

The also have a test console where you can try out your request and get the parameters correct.
Topics Extraction 2.0 Console | MeaningCloud[^]
 
Share this answer
 
Comments
cmansilla 15-May-16 1:16am    
Hi, i write them, but still dont have answer.
Thanks anyway, i keep looking.
George Jonsson 15-May-16 1:55am    
Try the console. It might be helpful.
The problem is that in order to test your code I need to create an account, and I have no use for that at the moment.
cmansilla 15-May-16 12:12pm    
Ok, i use the console and its ok, the problem is with the code in asp.net, i keep looking.
Thanks any way.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900