Not Found Error

https://bessapay.net/errors/not-found

Overview

A Not Found error occurs when the requested resource does not exist on the server. This error is returned with HTTP status code 404.

Details

  • Error Code: NOT_FOUND
  • HTTP Status: 404
  • Error Type: Client Error

Common scenarios

  • • Resource with the specified ID doesn't exist
  • • Resource was deleted or moved
  • • URL path is incorrect
  • • API endpoint doesn't exist

Example

Not Found Error Response
1{
2  "type": "https://bessapay.net/errors/not-found",
3  "title": "Resource Not Found",
4  "status": 404,
5  "detail": "The transaction with ID 'abc123' could not be found",
6  "instance": "/api/v1/transactions/abc123",
7  "errorCode": "NOT_FOUND",
8  "timestamp": "2023-06-15T14:22:45Z"
9}

How to Fix

Verify resource ID

Check that the ID or identifier you're using to access the resource is correct. Double-check for typos, case sensitivity issues, or formatting errors.

Check endpoint URL

Ensure you're using the correct API endpoint path. Refer to the API documentation to confirm the endpoint exists and is formatted correctly.

Confirm resource existence

Verify that the resource you're trying to access actually exists. It may have been deleted, or never created in the first place.

Check API version

Make sure you're using the correct API version. Some endpoints may change or be deprecated in newer versions of the API.

Code Example: Handling Not Found Errors

JavaScript Error Handling
1// Example of handling Not Found errors
2async function getTransaction(transactionId) {
3  try {
4    const response = await fetch(`https://api.semuni.com/v1/transactions/${transactionId}`, {
5      headers: {
6        'Authorization': `Bearer ${apiKey}`,
7        'Content-Type': 'application/json'
8      }
9    });
10    
11    if (response.status === 404) {
12      const errorData = await response.json();
13      console.warn(`Resource not found: ${errorData.detail}`);
14      
15      // Handle the not found error
16      if (errorData.errorCode === 'NOT_FOUND') {
17        // Show not found message to the user
18        showNotFoundMessage(transactionId);
19        
20        // Optionally, suggest alternatives or fallbacks
21        suggestAlternativeActions();
22      }
23      return null;
24    }
25    
26    if (!response.ok) {
27      // Handle other errors
28      const errorData = await response.json();
29      throw new Error(errorData.detail || 'An error occurred');
30    }
31    
32    const data = await response.json();
33    return data;
34  } catch (error) {
35    console.error('Error retrieving transaction:', error);
36    throw error;
37  }
38}