F fabioferreiracs Member Licensed User Longtime User Jan 13, 2013 #1 I need to make a GET request to get HomeTimeline from Twitter via the address: https://api.twitter.com/1.1/statuses/home_timeline.json . Already I have generated keys and access authorization header needed to make the request. But I do not know how to do this using Http request ! I try this: Code: Copy Dim request As HttpRequest MainUrl = "https://api.twitter.com/1/statuses/update.json" request.InitializeGet(MainUrl) request.SetHeader("Authorization" , Header) MainRequestId = 1 HttpClient1.Execute(request, MainRequestId) Header contains the Authorization header. But the result is unauthorized code 401. this header is entirely correct. I think the problem is the way I'm doing this request. Could someone give me a hand?
I need to make a GET request to get HomeTimeline from Twitter via the address: https://api.twitter.com/1.1/statuses/home_timeline.json . Already I have generated keys and access authorization header needed to make the request. But I do not know how to do this using Http request ! I try this: Code: Copy Dim request As HttpRequest MainUrl = "https://api.twitter.com/1/statuses/update.json" request.InitializeGet(MainUrl) request.SetHeader("Authorization" , Header) MainRequestId = 1 HttpClient1.Execute(request, MainRequestId) Header contains the Authorization header. But the result is unauthorized code 401. this header is entirely correct. I think the problem is the way I'm doing this request. Could someone give me a hand?
Erel B4X founder Staff member Licensed User Longtime User Jan 13, 2013 #2 Assuming that this service uses Basic or Digest authentication then you should use HttpClient.ExecuteCredentials. Upvote 0
Assuming that this service uses Basic or Digest authentication then you should use HttpClient.ExecuteCredentials.
F fabioferreiracs Member Licensed User Longtime User Jan 13, 2013 #3 I'm confused on how to generate this request. I tried the HttpClient.ExecuteCredentials , but also not worked. In the case of HttpClient.ExecuteCredentials the username and password need to be encoded? Would you like an example with some more details. My header is identical to that reported by Twitter. It's not wrong ! The response is always Unauthorized. My code is correct with respect to add the Header? And in making the request is correct? Where could it be my fault? Upvote 0
I'm confused on how to generate this request. I tried the HttpClient.ExecuteCredentials , but also not worked. In the case of HttpClient.ExecuteCredentials the username and password need to be encoded? Would you like an example with some more details. My header is identical to that reported by Twitter. It's not wrong ! The response is always Unauthorized. My code is correct with respect to add the Header? And in making the request is correct? Where could it be my fault?
Erel B4X founder Staff member Licensed User Longtime User Jan 14, 2013 #4 In the case of HttpClient.ExecuteCredentials the username and password need to be encoded? Click to expand... No. Upvote 0
In the case of HttpClient.ExecuteCredentials the username and password need to be encoded? Click to expand... No.
F fabioferreiracs Member Licensed User Longtime User Jan 21, 2013 #5 ok all working now. Using "HttpClient1.Execute" is enough to request in Twitter Upvote 0