Smart Search API (user not authorized to perform that action)

DrewHopkins
Community Explorer

Starting this off with a not sure if there's a way to cross-post here, as I also posted this in the AI community group: Smart Search API

Hi all, I am trying to utilize the Smart Search API, however, I am running into an unexpected error. 

When discussing this with a few technical leads at InstructureCon, we understood that the API endpoint should be accessible regardless of whether or not Smart Search is turned on for the account. 

However, when hitting the endpoint, I am getting the following error:
b'{"status":"unauthorized","errors":[{"message":"user not authorized to perform that action"}]}'

Here is my code:

    def get_embeddings(self, course_id,search_query):
        #/api/v1/courses/:course_id/smartsearch

        url = f"{self.server_url}/api/v1/courses/{course_id}/smartsearch"

        payload = {'q': search_query}

        r = requests.get(url, headers=self.headers(), params=payload)

        if r.status_code == 200:

            return r.json()

        else:

            r.raise_for_status()


I have verified the following:
- I am a sub account admin.
- I am an instructor in the course I am attempting to run the API on.
- The access token is valid.

Any ideas what may be causing this? Has anyone been able to successfully communicate with the end point?

Labels (3)
0 Likes