RESTful and invokable method dataset structures as JSON
 
Forums / SmartComponent Library - Developer Forum / RESTful and invokable method dataset structures as JSON

RESTful and invokable method dataset structures as JSON

7 posts, 1 answered
  1. Patrik Wikström
    Patrik Wikström avatar
    70 posts
    Registered:
    15 Oct 2018
    03 Jan 2023
    Link to this post
    REST CRUD methods have record and collection "style" JSON-result sets but invokable methods are using ProDataSet style result sets, e.g. serialized ProDataSet structures. Is this intentionally or is it due to a Progress limitation or something else?
  2. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    Answered
    03 Jan 2023 in reply to Patrik Wikström
    Link to this post
    You can return any JSON you like using the 

    response="return"

    option. When you make use of returning a ProDataset from the method, it feels more natural to return the ProDataset with it's built in serialization options.
  3. Patrik Wikström
    Patrik Wikström avatar
    70 posts
    Registered:
    15 Oct 2018
    03 Jan 2023 in reply to Mike Fechner
    Link to this post
    Ok, thanks! I now understand and can implement what we want. Still have to decided what we want.
  4. Patrik Wikström
    Patrik Wikström avatar
    70 posts
    Registered:
    15 Oct 2018
    03 Jan 2023
    Link to this post
    We have our own method, something like GetInitialValues in SCL, that in my mind seems more natural if it would return a record in the same way like when using REST Read?
  5. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    03 Jan 2023 in reply to Patrik Wikström
    Link to this post
    Nothing holds you back to return whatever you want. Define the method with RETURN JsonObject or JsonArray and the annotation with response=return. 

  6. Patrik Wikström
    Patrik Wikström avatar
    70 posts
    Registered:
    15 Oct 2018
    03 Jan 2023 in reply to Mike Fechner
    Link to this post
    Yeah, I understood that. :)
    Just wanted to get an opinion about GetInitialValues style of invokable method and what result set would be most natural in a RESTful world.
  7. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    03 Jan 2023 in reply to Patrik Wikström
    Link to this post
    GetInitialValues does not represent a resource at rest per se (it's not a record in the database). 

    It's a request to return a template for a new record. I doubt that any third party application would ever make use of that API. So return whatever is handy for your client.
7 posts, 1 answered