<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Troubleshooting on Anigeek</title><link>https://blog.anigeek.com/tags/troubleshooting/</link><description>Recent content in Troubleshooting on Anigeek</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 04 Jun 2025 17:00:00 -0600</lastBuildDate><atom:link href="https://blog.anigeek.com/tags/troubleshooting/index.xml" rel="self" type="application/rss+xml"/><item><title>Accessing Single Pages Via Wiki.js API</title><link>https://blog.anigeek.com/posts/accessing-single-pages-via-wikijs-api/</link><pubDate>Wed, 04 Jun 2025 17:00:00 -0600</pubDate><guid>https://blog.anigeek.com/posts/accessing-single-pages-via-wikijs-api/</guid><description>Getting Single Pages in Wiki.js</description><content:encoded><![CDATA[<p><a href="https://js.wiki">Wiki.js</a> is a powerful tool, and I&rsquo;ve enjoyed using it. The user interface is pretty intuitive, it looks great, and as a developer, I was excited to learn it even has <a href="https://docs.requarks.io/dev/api">a great API</a>!</p>
<p>Well, mostly.</p>
<p>Problems arise if you ever want to use the API to <a href="https://github.com/requarks/wiki/discussions/6216">access an individual page</a>. And it doesn&rsquo;t help that if you ask about it, <a href="https://github.com/requarks/wiki/discussions/6672">the official response</a> is that it&rsquo;ll be fixed in a version that might come out someday.</p>
<p>I was confused - as <em>the administrator</em>, surely I had permission to <em>look at a page</em>, right? Well, no, as it turns out:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;errors&#34;</span>: [
</span></span><span style="display:flex;"><span>    {
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;message&#34;</span>: <span style="color:#e6db74">&#34;You are not authorized to view this page.&#34;</span>,
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;locations&#34;</span>: [
</span></span><span style="display:flex;"><span>        {
</span></span><span style="display:flex;"><span>          <span style="color:#f92672">&#34;line&#34;</span>: <span style="color:#ae81ff">3</span>,
</span></span><span style="display:flex;"><span>          <span style="color:#f92672">&#34;column&#34;</span>: <span style="color:#ae81ff">5</span>
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>      ],
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;path&#34;</span>: [
</span></span><span style="display:flex;"><span>        <span style="color:#e6db74">&#34;pages&#34;</span>,
</span></span><span style="display:flex;"><span>        <span style="color:#e6db74">&#34;single&#34;</span>
</span></span><span style="display:flex;"><span>      ],
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;extensions&#34;</span>: {
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&#34;code&#34;</span>: <span style="color:#e6db74">&#34;INTERNAL_SERVER_ERROR&#34;</span>,
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&#34;exception&#34;</span>: {
</span></span><span style="display:flex;"><span>          <span style="color:#f92672">&#34;stack&#34;</span>: <span style="color:#e6db74">&#34;PageViewForbidden 6013: You are not authorized to view this page.\n    at single (/opt/wikijs/server/graph/resolvers/page.js:167:17)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)&#34;</span>,
</span></span><span style="display:flex;"><span>          <span style="color:#f92672">&#34;code&#34;</span>: <span style="color:#ae81ff">6013</span>,
</span></span><span style="display:flex;"><span>          <span style="color:#f92672">&#34;message&#34;</span>: <span style="color:#e6db74">&#34;You are not authorized to view this page.&#34;</span>,
</span></span><span style="display:flex;"><span>          <span style="color:#f92672">&#34;stacktrace&#34;</span>: [
</span></span><span style="display:flex;"><span>            <span style="color:#e6db74">&#34;PageViewForbidden 6013: You are not authorized to view this page.&#34;</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#e6db74">&#34;    at single (/opt/wikijs/server/graph/resolvers/page.js:167:17)&#34;</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#e6db74">&#34;    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)&#34;</span>
</span></span><span style="display:flex;"><span>          ]
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>      }
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>  ],
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;data&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;pages&#34;</span>: {
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;single&#34;</span>: <span style="color:#66d9ef">null</span>
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>  
</span></span></code></pre></div><p>So, after digging around, I found <a href="https://github.com/requarks/wiki/discussions/6216#discussioncomment-9316982">this comment</a> by GitHub user <a href="https://github.com/NellsRelo">NellsRelo</a>.</p>
<blockquote>
<p>I ran into this as well, but was able to get it working by giving the group Manage Page permissions. This isn&rsquo;t an ideal solution, as the API key could be then used to move or rename pages, but may shed light on the nature of the bug</p>
<p>&ndash; NellsRelo, May 4, 2024</p></blockquote>
<p>So, it seemed I just had to add the Manage Page permission, right?</p>
<p>&hellip; but I couldn&rsquo;t. I was the administrator. Administrator permissions can&rsquo;t change.</p>
<figure>
    <img loading="lazy" src="adminpermissions.png"/> <figcaption>
            Admin Permissions
        </figcaption>
</figure>

<p>So I just needed to make a new group, Super-Admin, and assign the permissions there, right?</p>
<figure>
    <img loading="lazy" src="superadminpermissions.png"/> <figcaption>
            Super Admin Permissions
        </figcaption>
</figure>

<p>&hellip; Nope. That didn&rsquo;t work, either. So after pulling out some hair and shouting into the void, I finally got it - the permissions I needed weren&rsquo;t permissions at all.</p>
<p>They were <em>Rules</em>.</p>
<figure>
    <img loading="lazy" src="pagerules.png"/> <figcaption>
            Page Rules
        </figcaption>
</figure>

<p>Nothing worked until I had <em>also</em> set the <code>manage:pages</code> <em>Page Rules</em>. I updated that, and everything snapped into place and I was able to use <code>single</code> and <code>singleByPath</code> queries with no problem. And with that, I was finally able to get the preview working for my <a href="github.com/Nasawa/CommandPaletteToolkit">Wiki.js Command Palette Extension</a>!</p>
<figure>
    <img loading="lazy" src="wikiextension.png"/> <figcaption>
            Wiki Extension
        </figcaption>
</figure>

]]></content:encoded></item></channel></rss>