I am trying to create a milestone on a project, but it gives me an error, and a body. Basecamp classic seems to have stopped appearing on Stack Overflow after 2015, and I looked at the Basecamp data structure (for the API) given in GitHub, but I don't see any clue as to how to solve this. I am working in PyCharm and Python 3.11.
Here is the content of the request to create a milestone
<?xml version="1.0" encoding="UTF-8"?>
<milestone>
<name>something</name>
<due_on>2025-02-18</due_on>
</milestone>
And here is the error
Traceback (most recent call last):
File "C:\Users\フリントポール
\PycharmProjects\pythonProject\Basecamp\ChatGPT_Basecamp_API.py", line 61, in <module>
main()
File "C:\Users\フリントポール
\PycharmProjects\pythonProject\Basecamp\ChatGPT_Basecamp_API.py", line 56, in main
create_milestone(project_id, milestone_name, milestone_due_on)
File "C:\Users\フリントポール
\PycharmProjects\pythonProject\Basecamp\ChatGPT_Basecamp_API.py", line 46, in > create_milestone
raise Exception(f"Failed to create milestone: {response.status_code} > {response.content}")
Exception: Failed to create milestone: 400 b'expected either a single milestone, or an > array of milestone entries'
ChatGPT suggested that I might get somewhere by putting pluralized tags (<milestones>
) around the above <milestones></milestones>
, which I tried and got this message (I cut it off after the page XML string started, to avoid bothering anyone):
Traceback (most recent call last):
File "C:\Users\フリントポール
\PycharmProjects\pythonProject\Basecamp\ChatGPT_Basecamp_API.py", line 63, in <module>
main()
File "C:\Users\フリントポール
\PycharmProjects\pythonProject\Basecamp\ChatGPT_Basecamp_API.py", line 58, in main
create_milestone(project_id, milestone_name, milestone_due_on)
File "C:\Users\フリントポール
\PycharmProjects\pythonProject\Basecamp\ChatGPT_Basecamp_API.py", line 48, in
create_milestone
raise Exception(f"Failed to create milestone: {response.status_code} {response.content}")
Exception: Failed to create milestone: 200 b'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
> 1.0 Transitiona . . . .
So it says that it was expecting a single milestone or an array of milestones. Here is the content of the request being posted.
<?xml version="1.0" encoding="UTF-8"?>
<milestones>
<milestone>
<name>ms1</name>
<due_on>2025-02-01</due_on>
</milestone>
</milestones>
That change of adding the array tags (is that what they are?) gave me a 200 message and a body. But no milestones (I looked at the XML in a browser, and it looked like milestone setting page, but very corrupted).