Hi @DanK , it is possible that the API connector is failing gracefully and returning a success response even if the URL is incorrect. In this case, you may need to modify your API connector to return an error response if it is unable to communicate with the endpoint. You can add error handling logic to your API connector code by doing something like this:
import requests
def call_api(endpoint_url, auth_token):
headers = {'Authorization': 'Bearer ' + auth_token}
response = requests.get(endpoint_url, headers=headers)
if response.status_code != 200:
# Return an error response if the API call fails
return {'error': 'API call failed'}
else:
# Return the response data if the API call succeeds
return response.json()
The call_api
function makes a GET request to the specified endpoint URL with the provided authentication token. If the API call fails (i.e., the response status code is not 200), the function returns an error response with a message indicating that the API call failed. If the API call succeeds, the function returns the response data in JSON format.
You can modify this code to handle other types of errors as well, such as network errors or authentication errors. More information here.
Please let me know if you have any questions and I can help you further.
If this answer helps you please mark "Accept Answer" so other users can reference it.
Thank you,
James