Giter Site home page Giter Site logo

Comments (12)

blandinw avatar blandinw commented on August 24, 2024

You should try without the "Authorization: " part:

wc.Headers[HttpRequestHeader.Authorization] = "Bearer $MYTOKEN";

from wit.

javirs85 avatar javirs85 commented on August 24, 2024

WoW That's a quick reply!

Now Im getting a (400) Bad Request.

May be the content type ?

This is the current code being executed:

        using (WebClient wc = new WebClient())
        {
            string URI = "https://api.wit.ai/message?q=what%20time%20is%20it%3F";
            wc.Headers[HttpRequestHeader.Authorization] = "Bearer BF54VOR3AJ33WKYEXEAYFFAEPJVR726V";
            string HtmlResult = wc.UploadString(URI, "");
        }

from wit.

blandinw avatar blandinw commented on August 24, 2024

It seems that .UploadString does a POST request. (http://msdn.microsoft.com/en-us/library/0645045y(v=vs.110).aspx)
You want a GET request here.

from wit.

javirs85 avatar javirs85 commented on August 24, 2024

oh man, you are good.

This is the final working code:

        using (WebClient wc = new WebClient())
        {
            string URI = "https://api.wit.ai/message?q=what%20time%20is%20it%3F";
            wc.Headers.Add("Content-Type", "text");
            wc.Headers[HttpRequestHeader.Authorization] = "Bearer xxxxxxxxxxxxxxxxxxx";
            string HtmlResult = wc.DownloadString(URI);
        }

May be someone wants to add it somewhere for future reference for people coding in C#.

By the way, how is the result is coming encrypted? is it a JSON ??

from wit.

blandinw avatar blandinw commented on August 24, 2024

Yes, the HTTP response is formatted as JSON.
We'll keep this snippet of code handy, thank you :)

from wit.

02zarna avatar 02zarna commented on August 24, 2024

How can i add multiple parameter in this coding

from wit.

02zarna avatar 02zarna commented on August 24, 2024
  using (WebClient wc = new WebClient())
    {
        string URI = "https://api.wit.ai/message?q=what%20time%20is%20it%3F";
        wc.Headers.Add("Content-Type", "text");
        wc.Headers[HttpRequestHeader.Authorization] = "Bearer xxxxxxxxxxxxxxxxxxx";
        string HtmlResult = wc.DownloadString(URI);
    }

I want to send multiple parameter in this code then how, this code working for me but i want this with multiple parameter pass in string. please hep me its solve my problem.

from wit.

l5t avatar l5t commented on August 24, 2024

Have you looked at other examples from the community? https://github.com/search?l=C%23&q=wit.ai+c%23&type=Repositories

from wit.

02zarna avatar 02zarna commented on August 24, 2024

Can i get Bluedart API Format in C# Asp.net. If you have any source code regarding this please give it to me.

from wit.

aforaleka avatar aforaleka commented on August 24, 2024

Hi @02zarna, you may want to ask the community in our FB group instead

from wit.

02zarna avatar 02zarna commented on August 24, 2024

Which FB group?

from wit.

l5t avatar l5t commented on August 24, 2024

https://www.facebook.com/groups/withackers

from wit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.