[Python] A very basic API question - is my request correct?

Discussão em 'Python' iniciado por Stack, Agosto 2, 2025.

  1. Stack

    Stack Membro Participativo

    I have a very simple API question (I'm at the start of my journey into learning how to use them). Basically I think the api key I have is incorrect but I want to be certain of that before I request another one. So please forgive me if the code is about as basic as it can get. I'm using Python.

    I wish to use the sumtracker API, and I'm just wanting to connect and do a basic get for this endpoint: https://inventory-api.sumtracker.com/api/version/2025-03/products/

    Let's say that my api-key is: 1234567890abc

    The code is here:


    url = "https://inventory-api.sumtracker.com/api/version/2025-03/products/"

    headers = {
    "accept": "application/json",
    "Authorization": "1234567890abc"
    }

    response = requests.get(url, headers=headers)


    The response gives a 403 and the text is:

    {"type":"client_error","errors":[{"code":"permission_denied","detail":"You do not have permission to perform this action.","attr":null}]}

    This suggests to me that the api key is not working correctly. This is the exact example that they give on their website: https://developers.sumtracker.com/reference/productlist so I have to presume it is correct.

    That said, on their authentication section (https://developers.sumtracker.com/reference/authentication-1), it says this:


    Authorization: Api-Key


    Lets say the API key is dv7dm.asm1hga2seks4uybay22hyuar


    Then, the value of the header will be Api-Key dv7dm.asm1hga2seks4uybay22hyuar
    ​

    Does this mean that the api key should also include that text? I have tried using this line:


    But it didn't seem to make a difference. Is it typical that the authorization will contain more than just the key itself?

    Well, thank you for your time. I hope somebody might stop by to help a beginner to all this.

    Continue reading...

Compartilhe esta Página