Where can I find the JSON-LD context document for ActivityStreams? So far I’ve just been able to find this one on GitHub, but I need a URL to link to under the @context field. It doesn’t seem to be available at ActivityStreams 2.0 Terms.
Also, I noticed that new users can only post two links per post here. I imagine it’s meant to reduce spam, but it means I couldn’t provide all the relevant links for my question.
As a newcomer to these standards, I find this very confusing, and I’m still unsure how to use them correctly. I’m trying to use jsonld-signatures to sign an ActivityStreams document, but it only works if I add .jsonld to the @context URL.
As I said, the jsonld-signatures library only works when I add .jsonld to the URL in the @context field. I’ve posted an issue to find out whether that’s intended behavior.
The context gives back JSON-LD if you use the correct Accept: application/ld+json mime type. Providing different representations for the same resources is a fundamental part of HTTP (content-negotiation).
I would consider this a bug in the jsonld-signatures library, it seems like it’s either not using the correct Accept header or not interpreting the results correctly.
Here’s an example of making the request with the correct Accept header:
The context gives back JSON-LD if you use the correct Accept: application/ld+json mime type. Providing different representations for the same resources is a fundamental part of HTTP (content-negotiation).
Agree! This is a minor point, but if you provide two representations and one gives machine readable data, the other one should too. Because a consuming app associates data with a URI, and not, a URI+mime type. So the HTML form is actually a bug, which could be fixed by adding JSON in a SCRIPT tag, which is the so-called “structured data island” approach popularized by schema.org
I dont think it’s something that anyone worries about. But machines can get confused from time to time, because of it.
I was able to resolve the error by using the library correctly. It turns out I had added .jsonld to the URL in the document loader, and it works without that extension. Here is my working example of signing an ActivityStreams document for anyone who is interested.