Hey,
So currently I am building a mobile application that pulls from the REST 2.0 API through an HTTP request protocol but currently, I have been unable to successfuly get data from the REST API. When going back to my terminal and following the REST 2.0 documentation on how to run GET requests, I don’t get the expected output
(for example on the page: http:/myrturl/REST/2.0/queues/all):
The expected output is JSON that brings back data regarding the queues. However, instead I simply get an html file that says the page was 302 Found.
If you go to the web UI for http://MyURL/REST/2.0
do you see the REST 2.0 documentation?
Yes, when I put that in I see the REST 2.0 documentation.
What does the HTML file say? Is there anything in your logs?
This was what was returned. I didn’t see anything in my Logs. This reply was printed is in HTML format so it might be formatted weird. But it returned a title of 302 found and a message that the document has moved to the URL of myurl/REST/2.0/queues/all
"
302 Found
Found
The document has moved here.
Apache/2.4.29 (Ubuntu) Server at MYADDRESS
"
I haven’t seen this before but 302 is a redirect, when doing the GET are you requesting the HTTPs URL? Maybe a redirect from port 80 to 443 is causing some confusion?
REST 2.0 documentation indicates to use
curl -H
'Authorization: token XX_TOKEN_XX'
'XX_RT_URL_XX/REST/2.0/queues/all'
Since my RT is running on another computer in my network, I usually input that computers IP address into ‘XX_RT_URL_XX’
Does the webserver have a redirect rule for SSL? Are you able to add 443
as the port for the IP address? 192.168.0.1:443
?
When I use 443 as the port, I receive a 400 Bad Request and a note that says Your browser sent a request that this server could not understand.
Reason: You’re speaking plain HTTP to an SSL-enabled server port.
And then when I replace http with https in my request, I receive the notification curl: (51) SSL: no alternative certificate subject name matches target host name ‘MYIPADDRESS’
I am unsure if the webserver has a redirect rule. Not really sure where to look for that?
It will be in your Apache config for RT, when you visit RT in your web browser is it a secured connection or insecure?
It is insecure when I visit it through my web browser
Then I would assume there isn’t a HTTPs redirect, but the 302 still points to some kind of redirect happening. I’d suggest looking at the Apache config for RT then
Realized it was due to my name-based virtualhost setup. Thanks for the help