@@ -25,14 +25,15 @@ a session in backend by a status field, a session cursor, or through
2525` ms.session.key.field ` specifies the key field in response in order to retrieve the
2626status for session control and the condition for termination.
2727
28- This property takes the form a JsonObject with a ** name** , a ** condition** ,
29- and a ** failCondition ** .
28+ This property takes the form a JsonObject with a ** name** , a ** condition** , a ** failCondition ** ,
29+ and a ** initValue ** .
3030
3131it takes the form a Json object with a "name", "condition", and "failCondition".
3232- ** name** specifies the field in response that gives session info, it is required
3333- ** condition** specifies when the session should stop.
3434- ** failCondition** specifies when the session should fail.
35- - "condition" and "failCondition" are optional
35+ - ** initValue** specifies the initial value of the session key. It is a string value such as "MDAzMzIwMDAwMXlqN3ZEQUFR"
36+ - "condition", "failCondition", and "initValue" are optional
3637- "condition" takes precedence over "failCondition"
3738
3839The "name" element of ms.session.key.field is one of following:
@@ -95,6 +96,17 @@ URL parameters or request bodies if HttpSource is used.
9596However, for the first HTTP request, because the
9697session variable has a NULL value, it will not be used in the request.
9798
99+ The ** initValue** parameter contains an optional initial session key value.
100+ When ** initValue** is not provided and a ` session ` type variable is defined in
101+ [ ms.parameters] ( ms.parameters.md ) , the default behavior is used in which on the
102+ initial request the session key is not included in the request URI or body, and on
103+ subsequent requests it is included. When an initial value is provided, this value
104+ will be passed to the ` session ` type variable on the initial run. This can be useful
105+ in certain scenarios:
106+ - To start cursor pagination from a specific page key when working with one work unit
107+ - to use cursor pagination on a POST request URI in which typically the variables defined in
108+ [ ms.parameters] ( ms.parameters.md ) are passed to the request body.
109+
98110### Examples
99111
100112In the following, the session key provides a stop condition:
@@ -118,4 +130,14 @@ streaming data.
118130
119131- ` ms.session.key.field={"name": "end_of_stream", "condition": {"regexp": "^true$"}} `
120132
133+ In the following, the session key is used as a cursor in the URI for a POST request. We can reference the session variable
134+ defined in [ ms.parameters] ( ms.parameters.md ) inside [ ms.source.uri] ( ms.source.uri.md ) such as ` <URI>/?next_page={{next_page}} ` .
135+ On the initial request, the cursor value must be present otherwise the next_page variable would not be substituted. So, an
136+ initial value is defined in ** ms.session.key.field** using "initValue". In this example, the API accepts an empty value
137+ for cursor as the same thing as no value. "" is substituted in as the initial cursor. Subsequent requests for cursor pagination
138+ work as normal.
139+ - ` ms.source.uri ` =` https://<URI>/?next_page={{next_page}}' `
140+ - ` ms.session.key.field={"name": "next_page", "condition": {"regexp": ""}, "initValue": ""} `
141+ - ` ms.parameters=[{"name":"next_page", "type":"session"}] `
142+
121143[ back to summary] ( summary.md#mssessionkeyfield )
0 commit comments