roed314 / seminars

Listing of online math seminars
GNU Affero General Public License v3.0
41 stars 15 forks source link

Adding talks to a seminar series #867

Closed everthemore closed 3 years ago

everthemore commented 3 years ago

We've been trying to set up an automated workflow that adds talks to a seminar series using the API. The seminar series has been created (series_id = 'speakerscorner'), and is currently unlisted.

Attempting to add a talk using the API seems to always result in status code 400 (Bad Request). I'm using the following snippet for this, and can confirm that the authorization works (via other API requests).

# Set up payload for talk creation
payload = {"series_id": "speakerscorner",
                    "title":talk.get('title'),
                    "speaker":talk.get('author'),
                    "online": True,
                    "start_time":talk["time"],
                    "timezone":"UTC"
                    }

url = "https://researchseminars.org/api/0/save/talk/"
r = post(url, json=payload, headers={"authorization":authorization()})
J = r.json()
code = J.get("code")

I wanted to add that directly copying the example on researchseminars.org/api (exactly the above, but with the payload only being the series_id) for adding a talk also results in the same error.

everthemore commented 3 years ago

Can confirm this works now. Closing!