405 Error Upon Generating a Report

Hello, I am attempting to send a post request to generate a report for a project. However, I am being met with a 405 error. I’m not sure what I’m doing wrong, could someone help me?

request_body = {
    "name": "contribution-raw-data",
    "schema": {
        "mode": "translations",
    }
}

response = requests.post(
    url=f"{crowdin_api_url}/projects/{crowdin_project_id}/reports/",
    data=json.dumps(request_body),
    headers={"Authorization": f"Bearer {access_token}"}
)

Hi @TranslationDev , have you authorized correctly? Please kindly see more information about that below:
https://developer.crowdin.com/api/v2/#section/Introduction/Authorization

As well, have you used the Generate Reports method?

I believe I am authorizing correctly as I am getting a 405 error, not a 401 or 403 (and I have used this method of authorization for other endpoints). I have never used the Generate Reports method before now but that is what I am currently attempting to use.

Dear @TranslationDev . Could you please also kindly tell us which role you have in the project where you try to run the Generate report method?

The role of the owner of the access token is manager.

Hi @TranslationDev,

Please try removing the slashes in your request :

url=f"{crowdin_api_url}/projects/{crowdin_project_id}/reports/"

change to :

url=f"{crowdin_api_url}/projects/{crowdin_project_id}/reports"

If it won’t solve the problem please share with us the ID of your Crowdin project.

1 Like