0 Replies Latest reply on Oct 28, 2012 3:36 AM by it2000

    Encode + as %2B within before=/after=?

    it2000

      On Jive REST API v3.0 one can read that the date format is

      "2012-09-01T11:00:00.000+0000" but this does not work (400 server error).

      "2012-09-01T11:00:00.000-0000" works fine.

      "2012-09-01T11:00:00.000%2B0000" also works fine (+ as %2B encoded).

      It seems that Jive does decode "+" as " ". All modern URI libraries do encode " " as "%20" and not as "+".

      For me this seems to be a bug within the REST API, or is this the intended behavior?

       

      The JavaScript functions escape(chr) and encodeURI(chr) do not modify the "+" sign, only encodeURIComponent(chr) does convert it to "%2B".

       

      I did test with "https://sandbox.jiveon.com/api/core/v3/inbox?filter=type(dm)&after=2012-09-01T11:00:00.000%2B0000", so everyone should be able to reproduce it.

       

      Jive itself does encode also the "-" character in its JSON response for no obvious reason:

      "links" : { "next" : "...&before=2012-10-27T17%3A54%3A18.546%2B0000", "previous" : "...&after=2012-10-27T17%3A54%3A18.546%2B0000" },

       

      Sample java code which fails to encode the URI properly.

      URI uri = new URI("https", "sandbox.jiveon.com", "/api/core/v3/inbox", "filter=type(dm)&after=2012-09-01T11:00:00.000+0000", null);
      // uri.toASCIIString() === https://sandbox.jiveon.com/api/core/v3/inbox?filter=type(dm)&after=2012-09-01T11:00:00.000+0000
      

       

      The HTTP 400 error:

      throw 'allowIllegalResourceCall is false.';

      {"error":{"message":"Invalid after date-time value 2012-09-01T11:00:00.000 0000","status":400}}