Jump to content









Photo

HTTP Response 401- Unauthorized.

API Stream

  • Please log in to reply
2 replies to this topic

#1 soli_carriot

soli_carriot

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 23 July 2018 - 12:21 PM

I have been trying to retrieve data from Carriots using ASP.Net HttpWebRequest, not working for me returns 401. Note: It is a free account

 HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create("http://api.carriots.com/streams/defaultDevice@soli_carriot.soli_carriot/");
      
        webrequest.Method = "GET";
        webrequest.ContentType = "application/vnd.carriots.v2+json";
        webrequest.ContentLength = 0;
        webrequest.Host = "api.carriots.com";
        webrequest.KeepAlive = true;
        webrequest.Headers["Carriots.apikey"] = "2d504ec70b3c3fcfcf0e22a576ca243696405a1dd706b4372da1df7e09c55d76";
        webrequest.Accept = "application/vnd.carriots.v2+json";
        webrequest.UserAgent = "GPS_Device Client";

        string result;
        using (WebResponse response = webrequest.GetResponse())
        {
            using (StreamReader reader = new StreamReader(response.GetResponseStream()))
            {
                result = reader.ReadToEnd();
            }
        }

 



#2 Yoleon

Yoleon

    Sugar Master

  • Members
  • PipPipPip
  • 50 posts

Posted 23 July 2018 - 02:05 PM

Hi soli_carriot,

 

I guess that you are trying to retrieve all the streams (limited to 1000 per request) of your device 'defaultDevice@soli_carriot.soli_carriot'.

 

The correct URI for your request is:

http://api.carriots.com/device/{device_id_developer}/streams/

 

I leave you the streams and device documentation:

 

I hope this helps you.

 

Regards,

 

Carriots Staff



#3 soli_carriot

soli_carriot

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 24 July 2018 - 04:17 AM

Hi soli_carriot,

 

I guess that you are trying to retrieve all the streams (limited to 1000 per request) of your device 'defaultDevice@soli_carriot.soli_carriot'.

 

The correct URI for your request is:

http://api.carriots.com/device/{device_id_developer}/streams/

 

I leave you the streams and device documentation:

 

I hope this helps you.

 

Regards,

 

Carriots Staff

Hi,

 

Now its working, thank you so much for your prompt response







Also tagged with one or more of these keywords: API, Stream

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users