How frequently can I safely cache the baseUrl?

后端 未结 2 997
误落风尘
误落风尘 2021-01-17 22:35

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

相关标签:
2条回答
  • 2021-01-17 23:17

    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.

    0 讨论(0)
  • 2021-01-17 23:17

    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.

    0 讨论(0)
提交回复
热议问题