BookOps-CAT / bookops-worldcat

BookOps WorldCat Metadata API wrapper
https://bookops-cat.github.io/bookops-worldcat/
MIT License
35 stars 7 forks source link

Trouble getting an access token from WorldcatAccessToken() #62

Closed johnjung closed 1 year ago

johnjung commented 1 year ago

I'm having some trouble getting an access token from WorldCatAccessToken() to query the Worldcat Search API. I see that the constructor accepts a few different parameters- I understand what key and secret are, but I'm not sure what kind of values to use for scopes, principal_id, and principal_idns.

Is there a list of scopes I can refer to? And what should I use for principal_id and principal_idns?

Thank you very much for any help you can provide- I appreciate it.

klinga commented 1 year ago

Apologies, @johnjung , I missed your inquiry (did not realize my notifications have not been turned off!).

bookops-worldcat does not support anymore Worldcat Search API, only Wordcat Metadata API (dropped at v 0.3.0 due to OCLC's changes in 2020). Your credentials for the Search API will not (most likely) work for Metadata API. Initially, I had plans to restore Search API functionality, but I think the priority now is to upgrade the package to Metadata API 2.0. Maybe someday in the future...

You could request credentials for the Metadata API and use bookops-worldcat and the service's search endpoints to get data out of OCLC. See here: https://developer.api.oclc.org/wc-metadata-v2#/Search%20Bibliographic%20Resources/search-brief-bibs

When you requested Metadata API credentials from OCLC you should have received an email that includes some of the information required to interact with their services. That email does not include your key or secret, only other related info, including sandbox records numbers. It should include something like that (copied from their docs)

Your Institution's Registry ID: 12345

Your Principal ID: 8eab9f92-3951-431c-975a-d7dfkd9rd131 Your principal IDNS: urn:oclc:wms:{registryID}

The scope for the Metadata API is: "WorldCatMetadataAPI"

Let me know if you need more help. My notifications are on now! Cheers!

johnjung commented 1 year ago

Thank you very much- this is very helpful, and I really appreciate it.

Thanks again!