Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 6.1.1 CE GA2, 6.1.20 EE GA2
    • Fix Version/s: 6.1.1 CE GA2, 6.1.20 EE GA2
    • Labels:
      None
    • Environment:
      Standalone REST client or Javascript client or Java client

      Description

      When you invoke a JSON service, it is necessary to pass all data as application/x-www-form-urlencoded. It is not possible to pass JSON object in the post body using application/json.

      For example, if we have data like shown below,

      var data = {
        "serviceMethodName" : "createBar",
        "servletContextName" : "test-json-portlet",
        "serviceParameters" : ["userId","userName"],
        "userId" : 10194,
        "userName" : "test"
      };
      

      Then the following code does not work,

      var url = "http://localhost:8080/api/json";
      									
      $.ajax({
        type : "POST",
        url : url,
        contentType : "application/json; charset=utf-8",
        dataType : "json",
        headers : {
          "Authorization" : "Basic dGVzdEBsaWZlcmF5LmNvbTp0ZXN0"
        },
        data : JSON.stringify(data),
        success : function(results) {
          console.log(results);
        } 
      });
      

        Attachments

          Activity

            People

            • Assignee:
              igor.spasic Igor Spasic
              Reporter:
              prashantdighe Prashant Dighe (Inactive)
              Participants of an Issue:
              Recent user:
              Esther Sanz
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                4 years, 21 weeks, 1 day ago

                Subcomponents