I tried to upload my custom model via REST API with the following code:
curl -X POST 'https://mohmlovpapp01.healthgrp.com.sg/api/v2/customModels/6384510809470eaf11538486/versions/' -H 'Content-Type: multipart/form-data' -H 'Accept: application/json' -H 'Authorization: Bearer {access-token}' -F 'filePath=rd.pkl' -F 'files=@/home/pamunixadm3001/rd.pkl' -F 'baseEnvironmentId={EnvironmentId}'
However, it returns the error message:
{"message": "Invalid field data", "errors": {"files": "Each file must have a corresponding filePath. Supply the files as a form-data list of `file` objects. And supply the relative file paths as a form-data list of `filePath` strings"}}
How do I resolve this issue? Thank you
The error message you received indicates that each file you're trying to upload must have a corresponding filePath field, but the filePath field you provided is not being recognized. Additionally, the files field is also not recognized as expected.
To fix this issue, you can try modifying the command as follows:
[["curl -X POST 'https://mohmlovpapp01.healthgrp.com.sg/api/v2/customModels/6384510809470eaf11538486/versions/' \
-H 'Authorization: Bearer {access-token}' \
-F 'model=@rd.pkl' \
-F 'modelType=python_pkl' \
-F 'baseEnvironmentId={EnvironmentId}']]
In this modified command:
Note that you will need to replace {access-token} and {EnvironmentId} with your own values.
I hope this helps you to resolve the issue. Let me know if you have any further questions!
Hi!
As it is described in the documentation:
So I guess your parameters are confused there. Try:
-F 'filePath=@/home/pamunixadm3001/' -F 'files=rd.pkl'