MongooseIM REST API 不适用于 POST 请求

MongooseIM REST API's not working for POST requests

有没有人试过用MongooseIM 2.0.0 Bets服务打web服务。

我能够调用此 Swagger site link 中定义的 GET 调用,但无法获得 POST 请求,因为它给我错误,因为我使用的是我的 IP 地址本地主机。

在我的 Mongoose Im 错误响应中。

] emulator Error in process <0.4026.0> on node mongooseim@localhost with exit value: {{nocatch,[{reason,{error,{3,invalid_json}}},{mfa,{mongoose_api_admin,from_json,2}},{stacktrace,[{jiffy,decode,2,[{file,"src/jiffy.erl"},{line,68}]},{mongoose_api_common,parse_request_body,1,[{file,"src/mongoose_api_common.erl"},{line,169}]},{mongoose_api_admin,from_json,2,[{file,"src/mongoose_api_admin.erl"},{line,114}]},{cowboy_rest,call,3,[{file,"src/cowboy_rest.erl"},{line,976}]},{cowboy_rest,process_content_type,3,[{file,"src/cowboy_rest.erl"},{line,777}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,442}]}]},{req,[{socket,#Port<0.35385>},{transport,ranch_tcp},{connection,keepalive},{pid,<0.4026.0>},{method,<<"POST">>},{version,'HTTP/1.1'},{peer,{{118,200,26,4},1036}},{host,<<"ec2-54-111-111-111.ap-southeast-1.compute.amazonaws.com">>},{host_info,undefined},{port,8090},{path,<<"/api/messages">>},{path_info,undefined},{qs,<<>>},{qs_vals,undefined},{bindings,[]},{headers,[{<<"host">>,<<"ec2-54-111-111-111.ap-southeast-1.compute.amazonaws.com:8090">>},{<<"user-agent">>,<<"curl/7.49.1">>},{<<"content-type">>,<<"application/json">>},{<<"accept">>,<<"application/json">>},{<<"content-length">>,<<"208">>}]},{p_headers,[{<<"content-type">>,{<<"application">>,<<"json">>,[]}},{<<"if-modified-since">>,undefined},{<<"if-none-match">>,undefined},{<<"if-unmodified-since">>,undefined},{<<"if-match">>,undefined},{<<"accept">>,[{{<<"application">>,<<"json">>,[]},1000,[]}]}]},{cookies,undefined},{meta,[{media_type,{<<"application">>,<<"json">>,[]}},{charset,undefined}]},{body_state,waiting},{buffer,<<"{ \ \n \"caller\": \"+6512345699@ec2-54-111-111-111.ap-southeast-1.compute.amazonaws.com\", \ \n \"to\": \"+6512345678@ec2-54-111-111-111.ap-southeast-1.compute.amazonaws.com\", \ \n \"body\": \"Hi Rabbit!\" \ \n }">>},{multipart,undefined},{resp_compress,false},{resp_state,waiting},{resp_headers,[{<<"content-type">>,[<<"application">>,<<"/">>,<<"json">>,<<>>]}]},{resp_body,<<>>},{onresponse,undefined}]},{state,{http_api_state,[<<"GET">>,<<"POST">>,<<"POST">>,<<"GET">>,<<"POST">>,<<"GET">>,<<"POST">>,<<"POST">>,<<"POST">>,<<"GET">>,<<"GET">>,<<"DELETE">>,<<"DELETE">>,<<"POST">>,<<"DELETE">>,<<"POST">>,<<"PUT">>],[],undefined,<<"messages">>,undefined,admin,[]}}]},[{cowboy_rest,process_content_type,3,[{file,"src/cowboy_rest.erl"},{line,777}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,442}]}]} 2016-11-02 05:25:37.428 [error] <0.4026.0> Ranch listener 'ejabberd_cowboy_166.36.16.166_8090' terminated with reason: {nocatch,[{reason,{error,{3,invalid_json}}},{mfa,{mongoose_api_admin,from_json,2}},{stacktrace,[{jiffy,decode,2,[{file,"src/jiffy.erl"},{line,68}]},{mongoose_api_common,parse_request_body,1,[{file,"src/mongoose_api_common.erl"},{line,169}]},{mongoose_api_admin,from_json,2,[{file,"src/mongoose_api_admin.erl"},{line,114}]},{cowboy_rest,call,3,[{file,"src/cowboy_rest.erl"},{line,976}]},{cowboy_rest,process_content_type,3,[{file,"src/cowboy_rest.erl"},{line,777}]},{cowboy_protocol,execute,4,[{file,...},...]}]},...]} in cowboy_rest:process_content_type/3 line 777

这里可能已回答:https://github.com/esl/MongooseIM/issues/1055。我说得对吗?