Update the endpoint for custom fields addition and add option to allow custom fields with non-ascii characters#7
Conversation
- change the endpoint for adding custom fields from /api/list/custom_fields to /api/customField and adapt the data format and the response code; - add the command line argument --utf-json to allow the creation of custom fields with non-ascii characters.
|
Hi Sergioamorim, Thank you very much for your PR, it took days trying to import "custom fields" and although I had seen that it is now "customField" I had not been able to import anything. In my case, when using the submit_config.py script, I get the following With a small change in the script, I have been able to import correctly although I have yet to see the real scope of that change in my lab. The change I have made has been to comment a couple of lines I'll tell you about it in case you can tell me what could have failed me or if the small change is enough. Regards, |
|
@fjavierc thanks for reaching out! I am sorry, I should have mentioned this before: the BooleanOptionalAction action from argparse only became available on the version 3.9 of Python. If you are using an older version, that is probably what is causing that error on line 90. Can you try again with a newer version, please? Also, I see you have set |
|
Sergioamorim, Tested with python 3.9 and everything correct !! I appreciate that you have bothered to answer me and for the clarification of my doubt. Regards |
The endpoint /api/customField is used on newer versions of TheHive to add custom fields. Also, to add custom fields that have non-ascii characters, the option ensure_ascii on json.dumps needs to be set to False (it is True by default).