Routes API - Unable to grab data from URL

Hi Community,

I built a tool to link multiple Revit models from ACC using Autodesk Platform Services (APS) and pyRevit.I’m currently using Postman for the authentication flow and get the access token but also trying to do this using the routes api.

I’ve successfully set up the server and endpoint (which is my callback url in the auth flow), tested printing out responses. But when APS sends the code for the access token through a query parameter, I just can’t seem to grab it through Routes. I’ve tried everything available on the request object (data, params, header) but everything returns empty.

Here is my startup.py script that I’m testing with:

from pyrevit import routes

api = routes.API("auth-api")

@api.route("/callback", methods=["GET"])
def get_code(request):
    data = []
    data.append(request.params)
    data.append(request.headers)
    data.append(request.data)
    data.append(request.path)
    return routes.make_response(data=data)

This is what I see when the endpoint is triggered.

I am not sure what I’m doing wrong … Any help or advice is appreciated.

Have you specified the correct callback url in the APS app?
(A mistake I have done myself before, so just to rule it out)

Hi Jonn, thanks for your response. Yes, I’m able to trigger the Autodesk login from Revit, and it redirects me to the callback URL with the code in the url. I’m just unable to access this code using the routes api.