What is the "href" in the document object response for?

Hi, I'm learning Prismic nowadays, and this is a beginner question.
On the documentation I see there is a "href" property with the value of our API endpoint. What is it exactly for? I can't find an explanation about this in the documentation.

Hey @yver,

This is a good question, and I'm not sure of the answer :laughing:

I'm going to ask some colleagues and get back to you :slight_smile:

Sam

@yver The href property contains a link to the API result for the individual document. This might be useful if, for some reason, you needed more data from that result.

Having said that, this isn't a very commonly used feature (as far as I know). Instead, we encourage users to use the fetchLinks and graphQuery options to access nested data from documents.

Let me know if you have any other questions!

Best,
Sam

Hi @samlittlefair, thanks a lot for the explanation :smiley:
From the security standpoint, is it better to remove the "href" from the response when sending it to the client or is it safe to just include it in the response?

Also, I searched graphQuery on Prismic documentation but no results. Do you have any resources for me to learn more about it? Is it the same as fetchLinks?

Hey @yver,

The href property doesn't include an access token, so it's safe to send to the client. Having said that, let me know if you have any other concerns that I'm not thinking of.

Here's the technical reference for GraphQuery.

Let me know if you have any other questions :slight_smile:

Best,
Sam

Thanks a lot, @samlittlefair for clarifying and the reference.
I will learn more about it :slight_smile:

1 Like