Page 1 of 1

API Key as Custom Bridge command line arg

Posted: Wed Jul 06, 2022 1:56 pm
by dcrider
Is it currently possible to send the client's API key as a command-line arg to a custom bridge? I didn't see it listed on the Output File page (https://opendental.com/manual/programli ... tfile.html)

Or is there a better way to access that from a custom bridge so I don't have to keep a copy of it saved in a text file somewhere?

Re: API Key as Custom Bridge command line arg

Posted: Thu Jul 07, 2022 8:21 am
by SLeon
Because a dental office could be using multiple third party software programs, and therefore be associated with multiple API keys, we cannot simply add API Key as a Replacement Field to the Program Link Output File window.

You can query this information directly from the customer's database, however, using the query below. See the API Key section of our API Setup page for additional information on this table.

Code: Select all

SELECT CustApiKey FROM apikey WHERE DevName='YourName';

Re: API Key as Custom Bridge command line arg

Posted: Fri Jul 08, 2022 8:52 am
by dcrider
It is my understanding that in order to call /queries/ShortQuery to be able to get the CustApiKey that I would first need to have the CustApiKey in order to add it to the authorization header.

Is there a way to get that key with just the developer's key?

Re: API Key as Custom Bridge command line arg

Posted: Fri Jul 08, 2022 9:31 am
by SLeon
The query can be run outside of the API. As the developer, you should be able to view all of your customer's API Keys when you are logged in to the Developer Portal website. Because you have to generate and give this key to the customer, most developers will also enter this into their software when it is installed at the customer's machine.

Re: API Key as Custom Bridge command line arg

Posted: Fri Jul 08, 2022 10:25 am
by dcrider
Thank you for the clarification.

If a customer's API key is disabled by the developer, I'm assuming all requests are returned with 401 - Unauthorized, is that correct? Does the apikey table also get updated when that happens?

Re: API Key as Custom Bridge command line arg

Posted: Fri Jul 08, 2022 10:41 am
by SLeon
Yes. If a customer's API Key has been disabled by the developer, any API request will return "401 - API key has been disabled by the developer".

The apikey table in the customer's database will still, however, contain this disabled key for a period of time. Their local table is refreshed whenever the customer opens the API Setup window in Open Dental.