JSDO request

Posted by Darren Parr on 30-Mar-2020 13:11

Hi

I've got my own invoke request working correctly. My routine takes a single dataset parameter. What makes the JSDO put the dataset inside a request object rather than making the dataset the request object?

I can't see the difference between a submit or an invoke in the catalog other than one is of type "submit" and the other "invoke". My routine takes an additional 3 other url parameters as query parameters and so I expected the dataset be the entire request, but I had to look for the ds inside the request object which surprised me. I'm sure there are rules to this but cant find any documentation to this.

Thanks

D

Posted by Tim Hutchens on 30-Mar-2020 13:49

Hi Darren,

From this article in the docs: https://documentation.progress.com/output/pdo/#page/pdo%2Faccessing-custom-invoke-operations.html%23 

"The invocation method passes any ABL input parameters as properties of a single object parameter."

I think this is a structured approach so that the JSDO can make calls to a data service the same way regardless of the number of inputs (0, 1, 2+).

Also, input parameters (of the method) are processed differently than URL parameters. See below example catalog snippet of ours that shows the "filter" (URL parameter) is a "type" QUERY vs the dsjc_work_schedule (dataset method input parameter) is a "type" REQUEST BODY.

                   {

                       "name": "SubmitEvents",

                       "path": "\/SubmitEvents",

                       "useBeforeImage": true,

                       "type": "submit",

                       "verb": "put",

                       "params": [

                           {

                               "name": "dsjc_work_schedule",

                               "type": "REQUEST_BODY"

                           },

                           {

                               "name": "dsjc_work_schedule",

                               "type": "RESPONSE_BODY"

                           }

                       ]

                   },

                   {

                       "name": "count",

                       "path": "\/count?filter={filter}",

                       "useBeforeImage": true,

                       "type": "invoke",

                       "verb": "put",

                       "params": [

                           {

                               "name": "filter",

                               "type": "QUERY"

                           },

                           {

                               "name": "numRecs",

                               "type": "RESPONSE_BODY"

                           }

                       ]

                   },

Hope this helps,

Tim

All Replies

Posted by Tim Hutchens on 30-Mar-2020 13:49

Hi Darren,

From this article in the docs: https://documentation.progress.com/output/pdo/#page/pdo%2Faccessing-custom-invoke-operations.html%23 

"The invocation method passes any ABL input parameters as properties of a single object parameter."

I think this is a structured approach so that the JSDO can make calls to a data service the same way regardless of the number of inputs (0, 1, 2+).

Also, input parameters (of the method) are processed differently than URL parameters. See below example catalog snippet of ours that shows the "filter" (URL parameter) is a "type" QUERY vs the dsjc_work_schedule (dataset method input parameter) is a "type" REQUEST BODY.

                   {

                       "name": "SubmitEvents",

                       "path": "\/SubmitEvents",

                       "useBeforeImage": true,

                       "type": "submit",

                       "verb": "put",

                       "params": [

                           {

                               "name": "dsjc_work_schedule",

                               "type": "REQUEST_BODY"

                           },

                           {

                               "name": "dsjc_work_schedule",

                               "type": "RESPONSE_BODY"

                           }

                       ]

                   },

                   {

                       "name": "count",

                       "path": "\/count?filter={filter}",

                       "useBeforeImage": true,

                       "type": "invoke",

                       "verb": "put",

                       "params": [

                           {

                               "name": "filter",

                               "type": "QUERY"

                           },

                           {

                               "name": "numRecs",

                               "type": "RESPONSE_BODY"

                           }

                       ]

                   },

Hope this helps,

Tim

This thread is closed