Bug #8957
closedRudder Directive Rest API does not parse json parameters correctly
Description
I run pretty much this:
curl -s -k -X PUT -H "X-API-Token: zzzz" \
-H "Content-Type: application/json" \
"https://localhost/rudder/api/latest/directives" \
-d @${o}
The file in -d looks like this:
@ cat jsonthing
{
"id": "some_specific_uuid",
"displayName": "varname",
"shortDescription": "This in an example Directive to use in Rudder api documentation",
"longDescription": "",
"enabled": true,
"system": false,
"parameters": {
"section": {
"name": "sections",
"sections": [
{
"section": {
"name": "Variable definition",
"vars": [
{
"var": {
"name": "GENERIC_VARIABLE_CONTENT",
"value": "REPLACE_THIS_TO_TEST"
}
},
{
"var": {
"name": "GENERIC_VARIABLE_NAME",
"value": "var_meepmeep"
}
}
]
}
}
]
}
},
"techniqueName": "genericVariableDefinition"
}@
{"action": "createDirective","id": "dff2e53b-5cbe-4c74-a07f-95775e7cc804","result": "success","data": {"directives": [{"id": "dff2e53b-5cbe-4c74-a07f-95775e7cc804","displayName": "varname","shortDescription": "This in an example Directive to use in Rudder api documentation","longDescription": "","techniqueName": "genericVariableDefinition","techniqueVersion": "2.0","parameters": {"section": {"name": "sections","sections": [{"section": {"name": "Variable definition","vars": [{"var": {"name": "GENERIC_VARIABLE_CONTENT","value": "733f9f34d2cd421afd5ef85295f9c8d5"}},{"var": {"name": "GENERIC_VARIABLE_NAME","value": "var_meepmeep"}}]}}]}},"priority": 5,"isEnabled": true,"isSystem": false}]}}
The UUID returned from the directive creation is NOT the one I gave.
If I try to pass in the ID via another parameter I find that it gets worse.
I add: -d "id=myuuid" \
and it'll say:
{"action": "createDirective","id": "b162f3c1-a725-4468-a7e9-f1956b6d21e1","result": "error","errorDetails": "Could not get create a Directive details because there is no value as display name."}
So 1) it again doesn't read the id 2) it doesn't read anything else either.
Maybe my -d call here is wrong.
In any case, it seems there is absolutely no way to use this as documented.
Could you please look into it?
It blocks all my progress tbh.