How frequently can I safely cache the baseUrl?
Asked Answered
N

2

9

Before each request to the DocuSign REST API, I make a call to https://demo.docusign.net/restapi/v2/login_information. But the only information I need from that response is the first baseUrl attribute, which never seems to change. If it truly never changes, I should just store the value as a constant, cutting my number of requests in half.

How often (or under what circumstances) does the baseUrl change, assuming my integration key is constant? More importantly, how infrequently can I safely cache the baseUrl?

Norvun answered 17/6, 2015 at 23:54 Comment(0)
S
6

Since it is a third-party API outside your control, I would recommend that you follow the requirements of the documentation, and make the call each time. There's no telling when they might change the internals of the API.

Scrimp answered 18/6, 2015 at 4:2 Comment(1)
Indeed - from current observation it doesn't change but DocuSign "reserves the right" to change it. Case in point: a customer might have their account moved from one environment (na2.docusign.net) to another (say eu.docusign.net). That would also change the baseUrl.Sixty
H
3

Short answer: cache with caution. It will most likely never change, but if it does, just grab it again. I would make the call at the beginning of a set of requests, and then forget about it.

The baseUrl parameter would look like: "https://demo.docusign.net/restapi/v2/accounts/123456"

To break it down:

  • demo.docusign.net -> Our uri, demo environment is as you expect, the demo site.
  • restapi/v2/ -> Using version 2 of the api
  • accounts/123456 -> Your account id particular to the demo site. (This will be a different id for the production site)

You would need to know this url for every api call. I wouldn't store it 'forever' just to be safe, but you could cache it for a short time to reduce the number of API calls. Your accountId should never change on the environment, but we do provide new environments occasionally, and every different account will have a different baseUrl.

For reference, see here: https://docs.docusign.com/esign/guide/usage/quickstart.html

If you really want to store it for a long time, I would set a 30 day time-out or something along those lines.

Homans answered 11/1, 2017 at 18:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.