connectapi icon indicating copy to clipboard operation
connectapi copied to clipboard

add `vanity_url` to `/v1/content` output

Open kmasiello opened this issue 10 months ago • 2 comments

/v1/content provides dashboard_url and content_url but does not provide the vanity URL, if set.

The old get_content_old() function would provide a TRUE/FALSE value for vanity_url and reported the url as the content_url.

The ergonomics of doing multiple API calls to get content info, get list of vanity url, and then joining is awkward.

kmasiello avatar Mar 29 '24 00:03 kmasiello

I need to dig further, but I suspect this might actually be a bug in the API of connect itself. From the API docs:

content_url: string The URL associated with this content. Computed from the associated vanity URL or GUID for this content.

Which to me reads as: the content_url will be the vanity if a vanity has been set or the GUID version if not, but when I tried it myself just now on content I know has a vanity I got back only the GUID. Why else would the docs mention vanity URL at all? But I'll need to dig into that and see if I can figure out what's wrong there.

This is a bit annoying, but you could also use connectapi::get_vanity_url() (though you have to construct a content item from each guid you have with connectapi::content_item(), and also concatenate the base URL onto the vanity suffix you get back)

jonkeane avatar Mar 29 '24 13:03 jonkeane

Should have reported back here earlier — it turns out that the docs were wrong. I've updated them, but vanities are not available there. They could (and probably should) be added to the API, but they are not there today.

So we'll have to do something like this in the meantime :(

This is a bit annoying, but you could also use connectapi::get_vanity_url() (though you have to construct a content item from each guid you have with connectapi::content_item(), and also concatenate the base URL onto the vanity suffix you get back)

jonkeane avatar Apr 16 '24 19:04 jonkeane