0
votes

Have anyone tried the MongooseIM 2.0.0 Bets services to hit web services.

I am able to to the GET calls as defined in this Swagger site link but unable to get the POST request as it gives me error for the same data that I use with my IP address instead of localhost.

Here in my Mongoose Im error response.

] 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

1

1 Answers

1
votes

This was probably answered here: https://github.com/esl/MongooseIM/issues/1055 already. Am I right?