eDOCS REST API - token timeout

Answers

  • To refresh the X-DM-DST token you must submit the following request:

    POST …edocsapi/v1.0/refresh?library=<primary library>

    With a payload containing the SESSION_AUTHORIZATION returned in the reply to the initial connect

    Example:

    Future refresh requests should use the SESSION_AUTHORIZATION returned from the previous refresh request

  • Btw, how can I configure "refresh" post endpoint? There is no documentation about that issue.

    I understand that "SESSION_AUTHORIZATION" must we set as a parameter at the end of the API code and I should refer it from the "refresh" endpoint but I have no idea how to configure it in a proper way.

    Should I include also "X-DM-DST" token as a parameter? How can I configure it on the security scheme?

  • There is nothing to configure.

    POST …edocsapi/v1.0/refresh?library=<primary library>

    The SESSION_AUTHORIZATION is sent as the payload of the POST request and the X-DM-DST is sent like all other requests, as a header or cookie from the browser

  • Al Slapsys
    edited November 17, 2023 #5

    POST …edocsapi/v1.0/refresh?library=<primary library>

    Where the "…" refers to the location of your REST API

  • Could u please share the API code including the refresh endpoint? I'll test it on Swagger editor.

  • If you provide an example of your request to your REST API, I will edit it for you

  • BoveMonteroAsociados
    edited November 17, 2023 #8

    There is no "refresh" endpoint as Documentation:

    For example, this is the "connect" endpoint:

    "/connect": {
    "post": {
    "tags": [
    "connection"
    ],
    "summary": "Connect to the DM Server and get key information in the response",
    "description": "Connect to one of the libriaries found in the response to the **libraries** request.",
    "requestBody": {
    "required": true,
    "content": {
    "application/json": {
    "schema": {
    "type": "object",
    "properties": {
    "data": {
    "type": "object",
    "properties": {
    "userid": {
    "type": "string"
    },
    "password": {
    "type": "string"
    },
    "library": {
    "type": "string"
    }
    },
    "example": {
    "userid": "DemoUserId",
    "password": "DemoPassword",
    "library": "DemoLibrary"
    }
    }
    }
    }
    }
    }
    },
    "responses": {
    "200": {
    "description": "Expected response to a valid request",
    "headers": {
    "Set-Cookie": {
    "schema": {
    "type": "string"
    }
    }
    },
    "content": {
    "application/json": {}
    }
    },
    "default": {
    "description": "unexpected error",
    "content": {
    "application/json": {
    "schema": {
    "$ref": "#/components/schemas/Error"
    }
    }
    }
    }
    }
    }
    }

  • You send all requests to the same REST API. The previous examples show the refresh request going to the my REST API where all other requests were sent.

  • BoveMonteroAsociados
    edited November 17, 2023 #10

    Sorry, I do not underastand the issue.

    I download the API:

    I test it on Swagger editor and it works until the token expires.

    Btw, the "X-DM-DST" is always the same and I got it from F12 mode at website login as Set-Cookie.

  • Yes, the X-DM-DST will be the same until refreshed

    If you are using the Swagger editor you should be able to use the POST request and supply the SESSION_AUTHORIZATION obtained from the initial connect request.

  • Could u please paste the full "refresh" endpoint JSON configuration?

    Just as I posted "connect" endpoint… including properties, response, parameters…

  • "/refresh": {
    "post": {
    "tags": ["connection"],
    "summary": "Refresh existing connection and get key information in the response",
    "description" : "Refesh existing connection and obtain a new information for future requests.",
    "security": [{"eDOCS_Authorization":[]}],
    "parameters": [
    {"$ref": "#/components/parameters/Library"}
    ],
    "requestBody": {
    "required": true,
    "content": {
    "application/json": {
    "schema": {
    "type": "object",
    "properties": {
    "data": {
    "type": "object",
    "properties": {
    "SESSION_AUTHORIZATION": {"type": "string"}
    },
    "example": {
    "SESSION_AUTHORIZATION": "8b3b19bc113410d88a16f82dafa5cg3"
    }
    }
    }
    }
    }
    }
    },
    "responses": {
    "200": {
    "description": "Collection of activities",
    "content": {
    "application/json": {
    "schema": {
    "$ref": "#/components/schemas/RefreshResponse"
    }
    }
    }
    },
    "default": {
    "description": "unexpected error",
    "content": {
    "application/json": {
    "schema": {
    "$ref": "#/components/schemas/Error"
    }
    }
    }
    }
    }
    }
    },

  • 		"RefreshResponse" : {
    "description": "Collection of items based on the provided criteria",
    "type": "object",
    "properties": {
    "data": {
    "type": "object",
    "properties": {
    "SESSION_DURATION": {"type": "integer"},
    "SESSION_AUTHORIZATION": {"type": "string"},
    "SESSION_TIMESTAMP": {"type": "string"},
    "X-DM-DST": {"type": "string"}
    }
    }
    }
    },