Forums

API example for webapp POST to create webapp

Similar to forum post https://www.pythonanywhere.com/forums/topic/13208/ ... is there any example available for how to post to /webapps/ to create a webapp? Specifically the content-type (assume application/json), and how things like the domain_name and python_version should be specified.

Thanks Brett

A bit more testing, it looks like this wants Content-Type: application/x-www-form-urlencoded parameters sent, so not application/json, or if it does accept that, I couldn't guess the schema.

Is this the same for all API POSTs, and/or PUTs, and is there any doc or example for that?

Also, no matter how I try to specify python_version, it isn't accepted - 2.7, 3.6 don't work, I get: { "status": "ERROR", "error_type": "invalid_python_version", "error_message": "No such Python version: 3.6" }

Regarding python_version, via https://github.com/pythonanywhere/helper_scripts/blob/master/pythonanywhere/api.py#L12 I learned python36 -> 3.6.

But this is more than a bit horrible, since when you read it back with GET, you have "python_version": "3.6", so no equivalence.

Needs fixing, no?

Thanks Brett

The API is still in beta and we'll be looking at this sort of thing as we move towards releasing it fully.

Thanks, just posting these here so they can be collected into issues for the next round of API work.

Thanks! I've made sure they're noted in our issue-tracking system so they don't get dropped.