import requests
import json


def call_api(url, endpoint_params):
    """
    Calls the API via a GET request
    :param url: the url of the endpoint
    :param endpoint_params: parameters for the endpoint
    :return: returns the response in json formatted
    """
    data = requests.get(url, endpoint_params)

    response = dict()
    response['url'] = url
    response['endpoint_params'] = endpoint_params
    response['formatted_endpoint_params'] = json.dumps(endpoint_params, indent=4, sort_keys=True)
    response['json_data'] = json.loads(data.content)
    response['formatted_json_data'] = json.dumps(response['json_data'], indent=4, sort_keys=True)

    return response