Gzip upload zipped model HTTP API

I would like to upload a local model to a Rasa X server using the HTTP API: upload zipped Rasa model

using python:

g = gzip.open("./models/20190626-132726.tar.gz", “rb”)
r = requests.post(url+"/api/projects/default/models", data=g, headers=header)

returns a <404> “No model found”. The request body schema set in the header: “content-type” = “application/gzip”.

Would be great to know how how to correctly upload a local model to a Rasa X server using the API.

Can you check the commandline if there has been any error logged? Might be related to Permission denied error on model upload · Issue #4331 · RasaHQ/rasa · GitHub

What do you mean? There are no errors related to the commands. The response of the post method is a <404> with message “Not found”.

Regarding the issue you are referring to, it is stated that the command or request that led to the error was:

Rasa X - Model Upload UI

Since this is not a CLI command, I guess the invoked command must have been the curl command provided in the UI of Rasa X, which looks something like:

curl -k -F "model@path/to/my_local_model.tar.gz" http://hostname/api/projects/default/models\?api_token\=....

The above curl expression (with correct http-reference and path to my model), works just fine. No errors, the model is uploaded and it works on the Rasa X server.

What I would like to know is how to correctly use the HTTP API for uploading a model from a local Rasa instance to my Rasa X server, since this would be preferred when automating such a task.

Using the Postman application, I get the following response: { “version”: “0.20.1”, “status”: “failure”, “message”: “Could not save model.\nNo model file found.”, “reason”: “ModelSaveError”, “details”: {}, “help”: null, “code”: 404 }