When I try to send this payload I get this response?
{
“_runtime”: 0.1591191291809082,
“message”: “object of type ‘NoneType’ has no len()”,
“success”: false
}
I’m following the pattern from the create.rst file in the Senaite JSON repo.
global BASE_URL
BASE_URL = “http://” + ip + “:” + port + “/”
global API_URL
API_URL = BASE_URL + SITE_ID + “/@@API/senaite/v1/”
data = { "portal_type": "AnalysisService",
"parent_path": "/senaite/bika_setup/bika_analysisservices",
"title": "<the name you want>",
"Keyword": "<unique keyword>",
"PointOfCapture": "lab",
"Category": "<you need to have the uid of the category>"
}
requests.post(API_URL+"/create", headers=headers, json=data, auth=AUTH)
After trying this approach I got this error:
{
“_runtime”: 0.1815950870513916,
“message”: “{“UpperDetectionLimit”: “Validation failed(isDecimal): 1000000000.0 of type <type ‘float’>, expected ‘string’”, “LowerDetectionLimit”: “Validation failed(isDecimal): 0.0 of type <type ‘float’>, expected ‘string’”}”,
“success”: false
}
I don’t think Senaite allows you to insert keywords that contain special characters (e.g. -), so please try to use a different keyword just for testing i.e. redBc
I did as you suggested and I got this error
{
“_runtime”: 0.1819760799407959,
“message”: “{“UpperDetectionLimit”: “Validation failed(isDecimal): 1000000000.0 of type <type ‘float’>, expected ‘string’”, “LowerDetectionLimit”: “Validation failed(isDecimal): 0.0 of type <type ‘float’>, expected ‘string’”}”,
“success”: false
}