API Access Token

Tagged:

Currently contains 4 posts

Avatar

April 21, 2015 00:04

jimmyhaley

Hello, probably an easy question here, but I’m struggling to find an answer in the documentation.

Right now, I can use our existing AppID and AppKey from the 3Scale site to then request an access token and use that to make my calls to the API…but I’m hoping to make this easier…everytime I’m using our reporting application (in this case, Excel’s Power Query functionality), I’m having to request a new Access Token rather frequently and it interrupts the overall data download process, making the reporting tool much less user friendly than I was hoping for.

Is there a way to make the sessionId/access token persist longer or indefinitely somehow? I guess I’m confused on what the functionality (if there is any) of the internal API Token within the PCR System menu (PCR>System>Database Settings>Api Settings). When I try to use that token, I can’t seem to get anything to happen except invalid token errors…perhaps I’m missing something, but any input would be greatly appreciated.

Avatar

April 21, 2015 14:07

Wayne-PCRecruiter

The length of the SessionId Access-Token returns is based on a user setting in the Global Timeout section of Database Settings (it is the same for all users). This value could be raised by a PCR Administrator but that will change it for all users.

Avatar

April 21, 2015 18:31

jimmyhaley

Thanks, Wayne. I’ve raised it in the PCR backend, but is there anyway to make it persist with login credentials? I have created an api user for PCR itself, can I just pass those credentials through the calls and access it indefinitely?

Avatar

April 21, 2015 19:07

Wayne-PCRecruiter

I’m not quite sure I understand your question. So long as you continually use the same sessionid in successive requests without waiting more than the Global Timeout setting for time between calls that should keep that session active.

i.e. I make a session request with Access-Token and receive a valid SessionId:

Then

…/candidates?query=LastName eq Smith&resultsperpage=25&page=1
header: Authorization: BEARER validSessionIdhere

Then

…/candidates?query=LastName eq Smith&resultsperpage=25&page=2
header: Authorization: BEARER validSessionIdhere

Then

…/candidates?query=LastName eq Smith&resultsperpage=25&page=3
header: Authorization: BEARER validSessionIdhere

So long as there is not a wait longer than the Timeout Setting between calls that SessionId will still work.

Reply to thread