NLU Config PUT API Call 400 error

@ricwo I’m trying out the config PUT endpoint you referenced in Github issue #4290. The GET call works fine but I can’t get the PUT to work.

I’m getting HTTP 400 errors in response with the message Failed when parsing body as json. I’ve tried different Content-Type values for the yaml content but it always returns 400. Any suggestions?

Hi @stephens, here’s the cURL that worked for me (left out the -H 'Authorization: ... header):

curl 'http://localhost:5002/api/projects/default/settings' -X PUT -H 'Content-Type: application/json;charset=UTF-8' -H 'Accept: application/json, text/plain, */*' -H 'Referer: http://localhost:5002/config' --data-binary '{"config":"language: en\npipeline: supervised_embeddings\npolicies:\n- name: MemoizationPolicy\n- name: KerasPolicy\n- name: MappingPolicy123123\n"}' --compressed

Let me know if that helps!

Thanks for the curl example. My problem was the format of the data. This call requires the yaml to be embedded in json.

I had copied the code I used for the Domain put call.

Both the domain and config put calls pass yaml data. Unfortunately, the format of the data in those calls is not consistent. I think the domain call passing the yaml directly is better because the code can suck up the users domain.yml file without having to manipulate the file.

If you think the development team would be receptive to a github issue requesting this change, I’ll submit one.

Thanks for the help.


Hi @stephens, yes, we’d welcome a pure-yaml /settings endpoint to make it consistent with other endpoints. Feel free to create an issue / PR. Thanks for the suggestion!

I submitted issue 4588. Thanks.