5 Replies Latest reply on Mar 18, 2016 9:21 AM by Kenny Elkington

    REST API expires_in regularity

    Takehiro Masaki

      Hi

       

      In this month, I am making REST API 8000 calls per day.

      Today I checked api logs, I found a few errors {"code":"601","message":"Access token invalid"} or {"code":"602","message":"Access token expired"}.

       

      So I investigated Get Access Token /oauth/token API.

      When I made 60 calls, only five expires_in are 3599 and the others are less than 100.

      My Question

      - Why is expires_in always 3599 or <100 always?

      - Why is expires_in random rather than orderly?

       

      Of course i know Marketo REST API Exception and Error Handling: Part 2 , but I think still strange.

      I expect 3598, 3597 ...2000...1000...700...

      I expect brand new token is always 3600.

       

      2016/03/16 19:00:36 Expires_in=3599 token=8b23d8d9-a0a6-4f92-9196-8d611ddba5cb:sj

      2016/03/16 19:00:37 Expires_in=4 token=2bbed36c-6ca1-4819-ac97-ef1f7446548f:sj

      2016/03/16 19:00:39 Expires_in=2 token=2bbed36c-6ca1-4819-ac97-ef1f7446548f:sj

      2016/03/16 19:00:40 Expires_in=1 token=2bbed36c-6ca1-4819-ac97-ef1f7446548f:sj

      2016/03/16 19:00:42 Expires_in=3599 token=b5424c6d-4dc0-4a09-a48f-25370591a575:sj

      2016/03/16 19:00:43 Expires_in=48 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:00:44 Expires_in=47 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:00:45 Expires_in=46 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:00:47 Expires_in=44 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:00:48 Expires_in=43 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:00:49 Expires_in=42 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:00:50 Expires_in=40 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:00:52 Expires_in=39 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:00:53 Expires_in=38 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:00:54 Expires_in=37 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:00:56 Expires_in=35 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:00:57 Expires_in=34 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:00:58 Expires_in=33 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:00:59 Expires_in=31 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:01 Expires_in=30 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:02 Expires_in=29 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:03 Expires_in=28 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:05 Expires_in=26 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:06 Expires_in=25 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:07 Expires_in=24 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:08 Expires_in=22 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:10 Expires_in=21 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:11 Expires_in=20 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:12 Expires_in=19 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:14 Expires_in=17 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:15 Expires_in=16 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:16 Expires_in=15 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:17 Expires_in=13 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:19 Expires_in=12 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:20 Expires_in=11 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:21 Expires_in=10 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:22 Expires_in=8 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:24 Expires_in=7 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:25 Expires_in=6 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:26 Expires_in=5 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:28 Expires_in=3 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:29 Expires_in=2 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:30 Expires_in=1 token=650090de-40ab-4c39-91b6-c6f995137ea1:sj

      2016/03/16 19:01:31 Expires_in=3599 token=d996382c-8efa-4317-ba27-0e56a4e353be:sj

      2016/03/16 19:01:33 Expires_in=3599 token=46e6cde2-9a32-40ce-971b-966f250b1aab:sj

      2016/03/16 19:01:34 Expires_in=8 token=b5ff4a67-3fcd-42c4-8e5a-a76757005d75:sj

      2016/03/16 19:01:36 Expires_in=7 token=b5ff4a67-3fcd-42c4-8e5a-a76757005d75:sj

      2016/03/16 19:01:37 Expires_in=6 token=b5ff4a67-3fcd-42c4-8e5a-a76757005d75:sj

      2016/03/16 19:01:38 Expires_in=5 token=b5ff4a67-3fcd-42c4-8e5a-a76757005d75:sj

      2016/03/16 19:01:39 Expires_in=3 token=b5ff4a67-3fcd-42c4-8e5a-a76757005d75:sj

      2016/03/16 19:01:41 Expires_in=2 token=b5ff4a67-3fcd-42c4-8e5a-a76757005d75:sj

      2016/03/16 19:01:42 Expires_in=1 token=b5ff4a67-3fcd-42c4-8e5a-a76757005d75:sj

      2016/03/16 19:01:43 Expires_in=3599 token=69721494-542b-405d-bc24-f5bf66e654cd:sj

      2016/03/16 19:01:45 Expires_in=48 token=ec03aec4-d51e-4518-9cbf-2cbd71569f53:sj

      2016/03/16 19:01:46 Expires_in=47 token=ec03aec4-d51e-4518-9cbf-2cbd71569f53:sj

      2016/03/16 19:01:47 Expires_in=46 token=ec03aec4-d51e-4518-9cbf-2cbd71569f53:sj

      2016/03/16 19:01:48 Expires_in=44 token=ec03aec4-d51e-4518-9cbf-2cbd71569f53:sj

      2016/03/16 19:01:50 Expires_in=43 token=ec03aec4-d51e-4518-9cbf-2cbd71569f53:sj

      2016/03/16 19:01:51 Expires_in=42 token=ec03aec4-d51e-4518-9cbf-2cbd71569f53:sj

      2016/03/16 19:01:52 Expires_in=40 token=ec03aec4-d51e-4518-9cbf-2cbd71569f53:sj

        • Re: REST API expires_in regularity
          Sanford Whiteman

          Wow, Takehiro, I don't see this at all.  It starts at 3599, yes, but counts down regularly (I put a 10-second pause in between calls).  Maybe open a Support case?

           

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3222,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3210,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3198,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3186,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3174,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3162,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3150,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3138,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3126,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3114,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3102,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3090,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3078,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3066,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3054,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3042,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3030,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3018,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":3006,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":2994,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":2982,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":2970,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":2958,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":2946,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":2934,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":2922,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":2910,"scope":"sandy@figureone.com"}

          ...

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":208,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":196,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":184,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":172,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":160,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":148,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":136,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":124,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":112,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":100,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":88,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":76,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":64,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":52,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":40,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":28,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":16,"scope":"sandy@figureone.com"}

          {"access_token":"e59bd83c-a7c1-4afa-8c66-47371113a0cc:sj","token_type":"bearer","expires_in":4,"scope":"sandy@figureone.com"}

          {"access_token":"eb004e96-ebe6-4b10-8e5c-8311cdd3b979:sj","token_type":"bearer","expires_in":3599,"scope":"sandy@figureone.com"}

          {"access_token":"eb004e96-ebe6-4b10-8e5c-8311cdd3b979:sj","token_type":"bearer","expires_in":3588,"scope":"sandy@figureone.com"}

          1 of 1 people found this helpful
          • Re: REST API expires_in regularity
            Kenny Elkington

            I'm curious if you have some services with different client ids and they're writing to the same log?