Developer

 View Only
last person joined: 3 hours ago 

Expand all | Collapse all

500 error trying to pull data from orchestrator using silverpeak API with python

This thread has been viewed 10 times
  • 1.  500 error trying to pull data from orchestrator using silverpeak API with python

    Posted Apr 11, 2024 03:31 PM

    I am really struggling with this.  Regardless of what I request, I receive a 500 error message back.  I have tried two separate API keys, with the same problem.  From the support | rest API section of Orchestrator this works: 

    https://burnsmcd-orch-use1.silverpeak.cloud:443/gms/rest/gms/appliance/preconfiguration?source=menu_rest_apis_id

    My orchestrator version is 9.1.5.40039

    When I try to pull the same data with the API key via python I receive a 500 error message back (whether I use pyconnect module from github or just a simple requests)

    Below is my simplest code to try to return a list of my reconfigurations:

    import requests
    import os

    # Define the API endpoint and your API key
    api_endpoint = "https://" + os.getenv("ORCH_URL")
    api_key = os.getenv("ORCH_API_KEY")
    GetAPIs_Url_addon = "/gms/rest/gms/appliance/preconfiguration"

    # Define headers with the API key
    headers = {
        "X-Auth-Token": api_key,
        "Content-Type": "application/json"
    }

    Orch = requests.session()
              response = Orch.get(api_endpoint+GetAPIs_Url_addon, headers=headers)


  • 2.  RE: 500 error trying to pull data from orchestrator using silverpeak API with python

    Posted 28 days ago
    1. Verify API Endpoint and Headers: Check that your endpoint URL and headers (including your API key) in your Python script exactly match those that work in the browser.
    2. Add Error Handling: Enhance your script to print out response.text or response.json() for more detailed error messages:
      response = Orch.get(api_endpoint + GetAPIs_Url_addon, headers=headers)
      print("Error:", response.status_code, response.text) if response.status_code != 200 else print("Success:", response.json())

      3. SSL Verification: If SSL issues are suspected, test with verify=False to bypass SSL verification (use cautiously).
      4. Test with REST Client: Use a REST client like Postman to ensure your request is correctly structured.

      If these steps don't clear up the error, reaching out to API support might be necessary to uncover why the server response differs when using Python.
      Regards: Roofing arlington va



  • 3.  RE: 500 error trying to pull data from orchestrator using silverpeak API with python

    Posted 28 days ago

    1. Verify API Endpoint and Headers: Check that your endpoint URL and headers (including your API key) in your Python script exactly match those that work in the browser.
    2. Add Error Handling: Enhance your script to print out response.text or response.json() for more detailed error messages:

    python
    Copy code
    response = Orch.get(api_endpoint + GetAPIs_Url_addon, headers=headers)
    print("Error:", response.status_code, response.text) if response.status_code != 200 else print("Success:", response.json())

    3. SSL Verification: If SSL issues are suspected, test with verify=False to bypass SSL verification (use cautiously).
    4. Test with REST Client: Use a REST client like Postman to ensure your request is correctly structured.

    If these steps don't clear up the error, reaching out to API support might be necessary to uncover why the server response differs when using Python.