anchor.diff:      undefined -> throw({missing_parameter, K});
       V -> V
     end;
  +
  +get_parameter({list, K, Default}, Qs) ->
  +  case proplists:get_value(K, Qs) of
  +    undefined -> Default;
  +    L when is_list(L) -> L;
  +    _V -> Default
  +  end;
  +
   get_parameter({boolean, K, Default}, Qs) ->
     case proplists:get_value(K, Qs) of
       true  -> true;
  
positive.code: -behaviour(cowboy_http_handler).
  
  -include_lib("apns/include/apns.hrl").
  -include_lib("include/pusherman_types.hrl").
  
  -export([init/3, handle/2, terminate/3]).
  
negative.code:   lager:debug("method: ~p path ~p",[Method,Path]),
    {404, list_to_binary(" not found " ++ Path)}.
  
  handle_status(_Req) -> 
    ?OK.
  
  handle_push(Req) -> 
    {ok, [{JsonParams,_}], _} = cowboy_req:body_qs(Req),
    [Params] = jsx:decode(JsonParams),
    lager:debug("json: ~p, decoded  ~p", [JsonParams, Params]),
    [MsgId, DeviceToken, Message, ActionLocKey, Badge, SoundFileName, Expiration, Extra, Type, Callback] = get_params(Params, [
      {binary, <<"msg_id">>, apns:message_id()},
      {string, <<"device_token">>},
      {string, <<"message">>},
      {string, <<"action_loc_key">>, none},
      {integer, <<"badge">>, none},
      {string, <<"sound_file_name">>, none},
      {integer, <<"expiration">>, apns:expiry(86400)},
      {raw, <<"extra">>, []},
      {string, <<"push_type">>,"unknown"},
      {string, <<"callback">>, "undefined"}
    ]),
    SoundFileName2 = case SoundFileName of
      "none" -> none;
      Other -> Other
    end,
  
    LocalizedMessage = case ActionLocKey of
      none -> Message;
      JsonStruct ->
        JsonContent = jsx:decode(unicode:characters_to_binary(JsonStruct)),
        [Action, Key, Args, Image] = get_params(JsonContent, [
          {string, <<"action">>, none},
          {string, <<"key">>, none},
          {list, <<"args">>, []},
          {string, <<"image">>, none}
        ]),
        #loc_alert{
          body = Message,
          action = Action,
          key = Key,
          args = Args,
          image = Image
        }
    end,
  
    Msg = #apns_msg{
      id     = MsgId,
      device_token = DeviceToken,
      alert  = LocalizedMessage,
      badge  = Badge,
      sound  = SoundFileName2,
      expiry = Expiration,
  