RestMethod - UnsupporteRequestEntityException When using JsonArray
 
Forums / SmartComponent Library - Developer Forum / RestMethod - UnsupporteRequestEntityException When using JsonArray

RestMethod - UnsupporteRequestEntityException When using JsonArray

6 posts, 1 answered
  1. Markus Grigoleit
    Markus Grigoleit avatar
    31 posts
    Registered:
    04 Jun 2019
    Answered
    10 Jan 2020
    Link to this post
    So the other day i tried to read in a jsonarray directly. Normally we would define some class and use it like this: 
    @RestMethod (address="/foo", requestMethod="post", parameterClassName="class.name.of.foo", response="return").
    METHOD PUBLIC VOID restMethod (foo AS class.name.of.foo):
    TEMP-TABLE ttTable:READ-JSON("JsonArray":U, foo:bar, "EMPTY":U).
    END METHOD.

    Its kinda annoying to define two files. So cant we just skip the middleman like this:

    @RestMethod (address="/foo", requestMethod="post", parameterClassName="Progress.Json.ObjectModel.JsonArray", response="return").
    METHOD PUBLIC VOID restMethod (foo AS Progress.Json.ObjectModel.JsonArray):
    TEMP-TABLE ttTable:READ-JSON("JsonArray":U, foo, "EMPTY":U).
    END METHOD.

    This is the result:

      "title": "An application error has occurred (Consultingwerk.OERA.RestResource.UnsupporteRequestEntityException)",
      "error": "Consultingwerk.OERA.RestResource.UnsupporteRequestEntityException",
      "message": "Invalid request entity type: Progress.Json.ObjectModel.JsonArray",
  2. Mike Fechner
    Mike Fechner avatar
    319 posts
    Registered:
    14 Sep 2016
    10 Jan 2020 in reply to Markus Grigoleit
    Link to this post
    Which release of the SmartComponent Library are you using? 
  3. Markus Grigoleit
    Markus Grigoleit avatar
    31 posts
    Registered:
    04 Jun 2019
    14 Jan 2020 in reply to Mike Fechner
    Link to this post
    Currently using;
    Release 11.3 #52880@2019-06-29 UTF-8
  4. Mike Fechner
    Mike Fechner avatar
    319 posts
    Registered:
    14 Sep 2016
    14 Jan 2020 in reply to Markus Grigoleit
    Link to this post
    Just checked - even the most recent release does not support the use of the JsonArray (or JsonConstruct) as a parameter to a method with RESTful. 

    Please log this as an enhancement request on support.consultingwerkcloud.com

    We should be able to add that quickly.
  5. Markus Grigoleit
    Markus Grigoleit avatar
    31 posts
    Registered:
    04 Jun 2019
    14 Jan 2020
    Link to this post
    Done: SCLSUP-239

    Thanks in advance!
  6. Markus Grigoleit
    Markus Grigoleit avatar
    31 posts
    Registered:
    04 Jun 2019
    05 Feb 2020
    Link to this post
    Fix is now included.
    For more infos look here: Release

    Thanks Mike
    Last modified on 05 Feb 2020 14:02 by Markus Grigoleit
6 posts, 1 answered