Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error occured while unregister a user using mod_restful #34

Open
shajunr88 opened this issue Mar 2, 2017 · 0 comments
Open

Error occured while unregister a user using mod_restful #34

shajunr88 opened this issue Mar 2, 2017 · 0 comments

Comments

@shajunr88
Copy link

shajunr88 commented Mar 2, 2017

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:
- path: ["admin"]
module: mod_restful_admin
params:
key: "secret"
allowed_commands: [srg_create, srg_user_add, status, registered_users, register, unregister, add_rosteritem, create_room]
- path: ["register"]
module: mod_restful_register
params:
key: "secret"
allowed_commands: [register, unregister]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant