dominik,
@dominik@nona.social avatar

Does anyone know what kind of headers one might need to send when requesting a url to get the data? I know I'm doing something wrong but no matter what, I'm always getting HTML.

JsonCulverhouse,
@JsonCulverhouse@flipboard.social avatar

@dominik
You are going to need an HTTP header that requests the correct content type -> "Accept: application/activity+json"

voxpelli,
@voxpelli@mastodon.social avatar

@dominik A more reliable way would be to look at the response and look for any hints there. I would hope that it is not a requirement that they both be served on same URL

Eg. Mastodon has references to their activitypub data in their HTML responses.

voxpelli,
@voxpelli@mastodon.social avatar

@dominik Mastodon includes a Link: in the HTTP-headers of the response of a post with a value of:

<https://mastodon.social/users/voxpelli/statuses/111918358674412396>; rel="alternate"; type="application/activity+json"

voxpelli,
@voxpelli@mastodon.social avatar

@dominik Looks like Pixelfed instead puts it as a <meta>-tag in the HTML <head>:

<link href='https://social.photo/p/AuQuotidien/662475636369520385' rel='alternate' type='application/activity+json'>

dominik,
@dominik@nona.social avatar

@voxpelli interesting - I don't see that in the HTML of my photo here: https://pixelfed.social/i/web/post/607151273451229256

voxpelli,
@voxpelli@mastodon.social avatar

@dominik Not a <meta>-tag, a <link>-tag, my bad!

voxpelli,
@voxpelli@mastodon.social avatar

@dominik Relevant standard if you are interested ;P https://datatracker.ietf.org/doc/html/rfc8288

voxpelli,
@voxpelli@mastodon.social avatar

@dominik This works for me:

GET /p/dominik/607151273451229256 HTTP/1.1
Accept: application/activity+json
Host: pixelfed.social

dominik,
@dominik@nona.social avatar

@voxpelli yeah, it's a bit weird. Same accept headers with curl and a REST Firefox plugin get different results. I guess it somehow listens to something else in the request. Just curl works fine.

voxpelli,
@voxpelli@mastodon.social avatar

@dominik Only okay field for it to check is the Accept-header, but they may do User-Agent sniffing as well

If they are well-behaved then they should include a Vary-header in their response to tell you which Header that may affect their response

  • All
  • Subscribed
  • Moderated
  • Favorites
  • Pixelfed
  • modclub
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • cubers
  • GTA5RPClips
  • thenastyranch
  • Youngstown
  • rosin
  • slotface
  • tacticalgear
  • ethstaker
  • kavyap
  • Durango
  • anitta
  • everett
  • Leos
  • provamag3
  • mdbf
  • ngwrru68w68
  • cisconetworking
  • tester
  • osvaldo12
  • megavids
  • khanakhh
  • normalnudes
  • JUstTest
  • lostlight
  • All magazines