I am using http request (post) to an api endpoint.
I pass the correct parameters for authentication on msg.payload {"username:"xxx","password":"password"}. The server return the statusCode = 302 and I can't read the set-cookie header.
How to solve this problem?
I was using the node-red-contrib-https 1.0.0. I changed to the HTTP Request Node that comes with node-red, import the tls certificate and everything works.
Related
I am using the apache HTTP component to call requests to domains. Ex: google.com, youtube.com, abc.xyz. I only have domains when calling the request I am not sure which protocol(HTTP or HTTPS) should be used.
final HttpGet httpget = new HttpGet("httpbin.org/get");
HttpResponse response =httpclient.execute(httpget);
So how do I can send a request without protocol(http,https)
I am requesting data from JSON server using axios. While I can see that JSON server is returning the X-Total-Count header using Postman, but axios does not see that header. I am using http protocol, so CORS should not be an issue. What am I missing?
Here's the call to json-server:
const resp = await axios.get('/orders?_start=0&_end=100');
const orderCount = resp.headers['X-Total-Count'];
Here are the headers received (captured in Chrome Devtools). Note that X-Total-Count is missing:
The same HTTP call in Postman shows that X-Total-Count is returned:
Solved. I used the command line option --no-cors and axios started seeing the X-Total-Count header.
When I connect to my on prem TFS server version 15.117.27414.0 using the url
GET http://{instance}/{collection}/{project}, I get a 200 OK using Basic Authentication with Base64 of PAT.
However, when I make an API call on this url say GET http://{instance}/{collection}/{project}/_apis/serviceendpoint/endpoints?api-version=3.2, I get a 404 error.
Request Header-
Content-type: application/json
Accept: application/json
Authorization: Basic ###########################
What am I doing wrong here?
That's not the correct URI.
https://learn.microsoft.com/en-us/azure/devops/integrate/previous-apis/endpoints/endpoints?view=tfs-2017
The URI would be:
_apis/distributedtask/serviceendpoints
I am trying link Actions on Google with a 3rd party service (non-Google). I am using Google Oauth 2.0 Playground to check if I am getting the auth code and the access token. I successfully received the auth code but when requesting the access token I am receiving the following result from the response.
HTTP/1.1 400 Bad Request
Content-length: 16
Content-type: text/plain
WWW-Authenticate
I am not sure when I am doing wrong here. What does WWW-Authenticate mean?
Thanks in advance.
In python (and my browser), I am able to send a request to https://www.devrant.com/api/devrant/rants?app=3&sort=algo&limit=10&skip=0 and get a response, as expected, but with Lua, I get HTTP/1.1 301 Moved Permanently. Here is what I have tried so far:
http = require("socket.http");
print(http.request("https://www.devrant.com/api/devrant/rants?app=3&sort=algo&limit=10&skip=0")
which outputs an HTTP error page (moved permanently) and
301 table: 0x8f32470 http/1.1 301 Moved Permanently
the table's contents are:
location https://www.devrant.com/api/devrant/rants?app=3&sort=algo&limit=10&skip=0
content-type text/html
server nginx/1.10.0 (Ubuntu)
content-length 194
connection close
date Mon, 11 Dec 2017 01:41:35
Why does only Lua get this error? If I request to google, I get the google home page HTML. If I request to status.mojang.com, I get the mojang server statuses in a JSON response string, so the socket is functional for certain.
It's because you are using socket.http to request a page from https URL; since socket.http doesn't handle https, it sends the request to port 80, which gets forwarded to https URL, but socket library doesn't follow that redirect, as it doesn't "know" what to do with https, so it simply reports 301.
You need to install and use luasec and use ssl.https instead of socket.http, which will make it work.