Academy

Responses when retrieving an email log

Responses when retrieving an email log

400 Bad Request

Description: This status code indicates that the request from the client was malformed or missing necessary information.

Why it happens:

  • The request body did not contain email_log_id.

  • The request body did not contain profile_email.

How to fix:

  • Ensure that the request body includes both email_log_id and profile_email fields before sending the request.

 

 

401 Unauthorized

Description: This status code indicates that the client failed to provide valid authentication credentials.

Why it happens:

  • The request headers did not include the x-alvas-api-key.

How to fix:

  • Include a valid x-alvas-api-key in the request headers.

 

 

403 Forbidden

Description: This status code indicates that the provided authentication credentials were not valid.

Why it happens:

  • The x-alvas-api-key provided in the request headers is invalid or not recognized.

How to fix:

  • Ensure that the API key being used is correct and valid. If you are unsure, contact the API provider to verify the key.

 

 

404 Not Found

Description: This status code indicates that the requested resource could not be found.

Why it happens:

  • No log was found for the provided emailLogId and profileEmail.

How to fix:

  • Verify that the emailLogId and profileEmail are correct and exist in the database.

 

 

202 Accepted

Description: This status code indicates that the request has been accepted for processing, but the processing is not complete.

Why it happens:

  • The log exists, but the generated email is not yet available.

How to fix:

  • Wait for 10 minutes and try the request again. This delay allows time for the email generation process to complete.

 

 

200 OK

Description: This status code indicates that the request was successful and the server responded with the requested resource.

Why it happens:

  • The request was properly formatted.

  • The provided email_log_id and profile_email matched an existing log.

  • The log contained the generated email.

  • The generated email was successfully retrieved and returned.

How to fix:

  • No action needed as this indicates a successful operation.

 

 

500 Internal Server Error

Description: This status code indicates that an unexpected error occurred on the server.

Why it happens:

  • An error occurred while trying to retrieve or process the log.

How to fix:

  • Check the server logs to identify the exact issue and resolve it. This could involve debugging the code, checking the database connection, or handling unexpected data.