Since all web request tools are slightly different I wanted to make sure I had clarity as I construct requests.
On Authentication I see Basic or Windows Integrated. In many cases I work with its a Bearer Token.
Today if I were to run this via CURL I’d setup a process to grab that token store as a variable and then pass it through. How should this be accomplished now that web requests are built in?
Append a URL parameter (or parameters) with token to every web request. In this case the token has to be specified in the Web Location connector properties.
Add a header (or headers) with token to every web request. In this case the token should be specified in the “Headers” tab of the Web Location connector, similarly to the previous case.
Web-form authentication, and cookie-based sessions. In this case, initial authorization is done via a web request with authorization through request body (see below). In this case, the body will have Content-Type application/x-www-form-urlencoded set automatically. Session cookies that come in the response are placed in the cookie container that is shared with all following web requests during project execution. If subprojects/modules are called, the cookie container is passed to them too, so that session cookies are available there too.
Basic HTTP authentication. In this case username and password should be specified in the Web Location connector properties. Again, session cookies are set in the cookie container that remains during project execution.
Of course, a URL parameter or header with a token can be added in every web-request manually. It’s just no so convenient.
@adambeltz, please post if you were successful in connecting / inter-operating with an external API using Web Requests. Can’t wait to see if it works in real-life scenarios
Sure thing. I’m away from my computer for the morning but I’m looking forward to trying this out. I have an integration project I am working on with Magento 2 and Im looking forward to trying this out.
The Web Request Action work also on HTTPS request ?
For me i got this error:
Error: An error occurred while sending the request.
The request was aborted: Could not create SSL/TLS secure channel.
Source: action “Web request”, table “request with curl”
Just as a call out. I’m loving the troubleshooting features as well. As an example I had a poorly defined request and I was able to quickly see what the problem was. Then the output file is very clean.