Skip to Main Content

Website Audit: API: Pull all LibGuide Pages

API: All Pages

Use an API to get a list of all pages--not guides--currently in the system. Pulled data includes:

  • Page ID
  • Group ID
  • Page Title
  • Description
  • Redirect URL (if any)
  • Status
  • Created Date
  • Last Updated
  • Friendly URL
  • URL

Be patient with this process. Depending on the size of the website, it may take a while for each step to run and compile.

Pull the data

  1. In the URL below, replace the highlighted "group_ids=" with the appropriate group id. Do not pull all groups at once. The resulting data will lock up your computer.

https://lgapi-us.libapps.com/1.1/guides?site_id=1470&key=054ed7c7e63fddfa401c2b0e34176b29&expand=pages&group_ids=2508

  1. In a sandbox guide, add a Remote Script widget.
  2. Add a descriptive name. Paste the URL into the script URL field.
  3. Copy the output and paste it into a JSON converter.

I like the JSON Formatter and Validator.

  1. Copy the output as unicode text into an Excel file.

Process the data in Excel

  1. Add a second sheet to the Excel document. Name it "Final".
  2. Run the visual basic code written by the estimable Caro Smith from OIRA, linked at the bottom of this box .
    1. Go to the sheet with the data on it.
    2. Use Alt+F11 to open the Visual Basic Editor.
    3. Under the VBA Project, select the sheet with the data.
    4. In the top navigation, go to Insert>Module.
    5. Copy Caro's code into the Book 1 area.
    6. Click the play button.
  3. If the script ran properly, the "Final" tab has readable data.

Note: In the final Excel data, a row with a Group ID is the first page in a guide. I add a column for the guide title using the page title in that Group ID row to populate the rest of the pages in that section.