Using the WorldCat Metadata API to delete LBD in bulk
Symptom
- You have a large batch of LBD control numbers you wish to delete, but this functionality is not available using LBD bulk actions in Record Manager
Applies to
- WorldCat Metadata API
Resolution
This process uses Postman and requires the following:
- WSKey with the WorldCat Metadata API service and associated secret
- Registry ID
- List of LBD control numbers in a CSV document - Example CSV file
- The CSV document should be a single column with controlNumber in the first row, followed by the list of LBD control numbers
- Custom LBD Bulk Delete Postman Environment - JSON file
- Custom LBD Bulk Delete Postman Collection - JSON file
This is a two-part process. The first part only needs to be done once, and once set up, the second set of steps may be performed multiple times.
Part 1: Postman Setup
- Install Postman if you have not already --- This is not an OCLC software, but a free API testing platform. More information may be found at Postman.com
- Open Postman
- In the "My Workspace" pane on the left side, click Import
- Click Files and choose the downloaded Environment JSON file
- In the new environment, fill in your WSKey, secret, and Registry ID in the available fields
- Press Ctrl + S to save your changes
- In the top right corner, if your new environment is not chosen, click the dropdown to set your new Delete LBDs environment
- In the "My Workspace" pane on the left side, click Import
- Click Files and choose the downloaded Collection JSON file
Once this is complete, you will be set up with a custom environment and collection in Postman to perform the sole purpose of deleting LBD records in bulk. This collection only contains one endpoint. More information about the other capabilities of the WorldCat Metadata API can be found on the OCLC Developer Network.
Part 2: Running the delete process
These steps can be repeated multiple times, but first require the above to be complete. If any step of the above is missing, these steps will not work.
- Open Postman
- Ensure that "Delete LBDs" is chosen as the environment in the top-right corner
- In the left navigation pane, choose Collections
- Click into your "Bulk Delete LBD" collection, then into the Authorization tab
- Under Token, click Refresh or click the orange Generate New Token at the bottom of the tab
- Click Proceed and Use Token
- In the bottom right corner, click Runner
- Drag and drop the entire "Bulk Delete LBD" collection into the location
- Click Select File to upload your CSV list of LBD control numbers
- Click the orange Run Bulk Delete LBD button
You should then see each request run with one of the control numbers in your file. If the deletion is successful, you can expect a green 200 response. Possible error responses include:
- 401 - This indicates an authorization error. Contact OCLC Support with the request and the first 10 digits of the WSKey you were using
- 404 - This indicates that the LBD control number you entered was not found
- 409 - This indicates that the LBD control number you entered belongs to another library, and thus you don't have permission to delete it
If you see a different error message or otherwise have problems with any of the steps above, contact OCLC Support with a link to this article, your OCLC symbol, and the first 10 digits of the WSKey you are using.
