jadahl / mod_restful

RESTful interface to ejabberd
84 stars 34 forks source link

Error occured while unregister a user using mod_restful #34

Open shajunr88 opened 7 years ago

shajunr88 commented 7 years ago

I had installed mod_restful in ejabberd 16.09 .The api is working fine for user creation,chat room creation etc.But when trying to unregister a user,it is getting the response as 400 Bad Request and getting the following error from the ejabberd log.

2017-03-02 09:07:32.304 [debug] <0.536.0>@ejabberd_http:process_header:286 (#Port<0.24524>) http query: 'POST' <<"/api/admin">> 2017-03-02 09:07:32.304 [debug] <0.536.0>@ejabberd_http:extract_path_query:400 client data: <<"{\"key\":\"secret\",\"command\":\"unregister\",\"args\":[\"shaju1111112\",\"ec2domain.com\",\"password\"]}">> 2017-03-02 09:07:32.305 [debug] <0.536.0>@ejabberd_http:process:358 [<<"api">>,<<"admin">>] matches [<<"api">>] 2017-03-02 09:07:32.305 [error] <0.536.0> Processing throwed error function_clause trace: [{lists,zip,[[],[<<"nagainfo">>]],[{file,"lists.erl"},{line,386}]},{lists,zip,2,[{file,"lists.erl"},{line,386}]},{lists,zip,2,[{file,"lists.erl"},{line,386}]},{mod_restful_admin,format_args,2,[{file,"src/mod_restful_admin.erl"},{line,163}]},{mod_restful_admin,run_command,3,[{file,"src/mod_restful_admin.erl"},{line,153}]},{mod_restful_admin,do_process,1,[{file,"src/mod_restful_admin.erl"},{line,89}]},{mod_restful,handle_rest_request,5,[{file,"src/mod_restful.erl"},{line,193}]},{mod_restful,process,2,[{file,"src/mod_restful.erl"},{line,161}]}]

Following is the api i used to call POST /api/admin HTTP/1.1 Host: ec2domain:5285 Content-Type: application/json Cache-Control: no-cache {"key":"secret","command":"unregister","args":["shaju1111112","ec2domain","password"]}

Following is the ejabberd.yml configuration mod_restful: api: