I’ve been working with the Notion Public API and I’m trying to figure out how to get the URL of a page. So far, I can fetch page properties and some basic metadata like the object type, ID, and timestamps for creation and last edit.
But what I really need is the page slug or full URL, especially for items in a database. Is there a way to do this with the current API? I’ve looked through the docs but couldn’t find anything specific.
Has anyone managed to get page URLs using the API? Any tips or workarounds would be super helpful!
hey there! i’ve been messing with the notion api too and ran into the same issue. what i did was use the page ID to build the URL manually. it’s not perfect, but it works for most cases. just remember these URLs only work for ppl with access to your workspace. hope that helps!
I encountered a similar challenge when working with Notion’s API recently. Unfortunately, the current API doesn’t directly provide page URLs or slugs. However, I found a workaround that might help.
Keep in mind that these URLs will only work for users with access to the workspace. For public sharing, you’d need to use Notion’s share functionality separately. It’s not ideal, but it’s the best solution I’ve found so far. Hopefully, Notion will add direct URL retrieval in future API updates.
I’ve been working extensively with Notion’s API, and I can confirm that retrieving page URLs isn’t straightforward. However, I’ve discovered a neat trick that might help.
While the API doesn’t provide direct access to page URLs, you can leverage the ‘url’ property of block objects. Here’s how:
Fetch the page using the ‘retrieve page’ endpoint.
Use the ‘retrieve block children’ endpoint with the page ID.
Look for the first block with a ‘type’ of ‘page’. This block should have a ‘url’ property.
This method works for both standalone pages and database entries. It’s not perfect, as it requires an extra API call, but it’s reliable in my experience.
Remember to handle rate limits and permissions carefully when implementing this approach. Good luck with your integration!