How to consume a Toi Rest of Tookan?

0

good afternoon, I'm a bit new in the API's Rest, I need to consume the following api: link , reading the documentation for what I understood is to perform POST methods, I do not know how to do it to consume it through GET, I use a console application in C #, my code is as follows:

// Get method

        WebRequest req = WebRequest.Create(@"https://api.tookanapp.com");

        req.Method = "GET";

        HttpWebResponse resp = req.GetResponse() as HttpWebResponse;
        if (resp.StatusCode == HttpStatusCode.OK)
        {
            using (Stream respStream = resp.GetResponseStream())
            {
                StreamReader reader = new StreamReader(respStream, Encoding.UTF8);
                Console.WriteLine(reader.ReadToEnd());
            }
        }
        else
        {
            Console.WriteLine(string.Format("Status Code: {0}, Status Description: {1}", resp.StatusCode, resp.StatusDescription));
        }
        Console.Read();

at the end of the day it sends me an error 404, I guess because it does not reach the server ....

Thank you very much for the help!

    
asked by LuisMB92 14.12.2018 в 00:28
source

1 answer

0

If we analyze the documentation of the library

Tookan API

You will notice that the url https://api.tookanapp.com is the base url from which you must define what actions you are going to perform, for example, mention https://api.tookanapp.com/v2/create_task to create a task

You also need to have a api key to be able to access the functionality, mention it in the documentation

  

Tookan API uses key based authentication method. You can get to key from settings (Login> Menu> Settings> API Keys) in your tookan account

for which you need to have an account

Analyzing the error code makes reference that a 404 is:

404 -- ERROR_IN_EXECUTION 

For example, if you access: link

You'll see that the url of the api to get the task list is: link

and this is invoked as POST

On the right you have a window that shows an example with code c # of how it implements the invocation to the api

I recommend that you analyze the documentation better because it is very complete and use the class HttpClient to invoke the API

    
answered by 14.12.2018 в 00:46