HTTP Request Piece

I am trying to access my Mailjet account and keep getting a 401 error which means there is an authorization error. I’m sure I have something set up incorrectly. Is there more documentation on how to set up a Send HTTP Request piece?

It’s better to check the documentation, Usually you need to add Header called Authorization with value specified in their system.

https://dev.mailjet.com/email/guides/#authentication

Basic Authentication is a simple and commonly used method for securing access to web resources. It involves sending a username and password as part of the request headers. Here’s a breakdown of the steps involved:

  1. Authorization Header: In the context of web development, the Authorization header is used to send credentials (username and password) with a request. This header is included in the HTTP request, and its value typically follows a specific format.

  2. Basic Authentication Format: The basic format for Basic Authentication involves combining the username and password with a colon (:), and then encoding the resulting string using Base64. The encoded string is then prefixed with the word “Basic”.

    For example:

    • If the username is API_KEY and the password is API_SECRET, you would concatenate them as API_KEY:API_SECRET.
    • Then, you encode this string using Base64, resulting in something like QVBJX0tFWTpBUElfU0VDUkVU.
  3. Including in Requests: When making an HTTP request to a server that requires Basic Authentication, you include the Authorization header with the value “Basic” followed by the encoded credentials. For instance:

    Authorization: Basic QVBJX0tFWTpBUElfU0VDUkVU
    

TLDR: You should include Authorization in Headers with the value calculated as above.

Another way to make ChatGPT generate code and use it in code piece directly :smiley:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.