This specification details a model for representing potential and completed activities using the JSON format.
This is an Editor's Draft. There are a significant number of changes that have been made to this vocabulary since the publication of the First Public Working Draft. All changes should be considered provisional pending working group discussion and acceptance.
In the most basic sense, an "Activity" is a semantic description of an action. It is the goal of this specification to provide a JSON-based syntax that is sufficient to express metadata about activities in a rich, human-friendly but machine-processable and extensible manner. This can include constructing natural-language descriptions or visual representations about the activity, associating actionable information with various types of objects, communicating or recording activity logs, or delegation of potential actions to other applications.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [[!RFC2119]].
The JSON Activity Streams 1.0 [[!AS1]] specification was published in May of 2011 and provided a baseline extensible syntax for the expression of completed activities. This specification builds upon that initial foundation by incorporating lessons learned through extensive implementation, community feedback and related ongoing work from a variety of other communities.
objectType should be treated as reserved terms that
SHOULD NOT be used within Activity Streams 2.0 documents. When
encountered in an Activity Streams 2.0 document, they SHOULD be
processed in accordance to the guidelines listed in
This specification describes a JSON-based [[!RFC7159]] serialization syntax for the Activity Vocabulary that conforms to a subset of [[!JSON-LD]] syntax constraints but does not require JSON-LD processing. While other serialization forms are possible, such alternatives are not discussed by this document.
When serialized, absent properties are represented by either (a) setting the property value to null, or (b) by omitting the property declaration altogether at the option of the publisher. These representations are semantically equivalent. If a property has an array value, the absence of any items in that array MUST be represented by omitting the property entirely or by setting the value to null. The appropriate interpretation of an omitted or explicitly null value is that no value has been assigned as opposed to the view that the given value is empty or nil.
This specification uses IRIs [[!RFC3987]]. Every URI [[!RFC3986]] is also an IRI, so a URI may be used wherever an IRI is named. There are two special considerations: (1) when an IRI that is not also a URI is given for dereferencing, it MUST be mapped to a URI using the steps in Section 3.1 of [[!RFC3987]] and (2) when an IRI is serving as an "id" value, it MUST NOT be so mapped.
Relative IRI (and URL) references SHOULD NOT be used within an Activity Streams 2.0 document due to the fact that many JSON parser implementations are not capable of reliably preserving the base context necessary to properly resolve relative references.
Unless otherwise specified, all properties with date and time values MUST conform to the "date-time" production in [[!RFC3339]], with an uppercase "T" character used to separate date and time, and an uppercase "Z" character in the absence of a numeric time zone offset. All such timestamps SHOULD be represented relative to Coordinated Universal Time (UTC).
An Activity Streams
Document is a JSON document whose root value is an
Activity Streams Object of any type and whose MIME media
type is "
Activity Streams 2.0 documents MUST be serialized using the UTF-8 character encoding.
The serialized JSON form of an Activity Streams 2.0 document MUST be consistent with what would be produced by the standard JSON-LD 1.0 Processing Algorithms and API [[!JSON-LD-API]] Compaction Algorithm using, at least, the normative JSON-LD @context definition provided here. Implementations MAY augment the provided @context with additional @context definitions but MUST NOT override or change the normative context. Implementations MAY also use additional properties and values not defined in the JSON-LD @context with the understanding that any such properties will likely be unsupported and ignored by consuming implementations that use the standard JSON-LD algorithms. See the Extensibility section for more information on handling extensions within Activity Streams 2.0 documents.
JSON-LD uses the special
@context property to define the
context. The value of the
@context property is defined
by the [[JSON-LD]] specification. Implementations producing Activity
Streams 2.0 documents SHOULD include a
with a value that includes a reference to the normative
Activity Streams 2.0 JSON-LD
@context definition using the URL
Following are three examples of activities with varying degrees of detail.
Each example is shown using the normative JSON serialization defined by this specification along with generally equivalent, non-normative Microdata, RDFa, Microformats, and Turtle serializations. These non-JSON alternatives are included solely for illustrative purposes.
The Microdata, RDFa and Microformats examples included in this document are purely informative and may not currently reflect actual implementation experience or accepted best practices for each format. These alternate serializations may be removed from future iterations of this document and moved to a separate informative WG Note.
The Activity Vocabulary normatively defines the core object types and properties for Activity Streams 2.0.
The object types defined by the vocabulary are segmented into a set of eight core types and an extended set of Activity and Object types common to many social Web applications. The core classes include: Object, Link, Actor, Activity, Collection, OrderedCollection, CollectionPage, and OrderedCollectionPage.
is the primary base type for the Activity Streams vocabulary.
In addition to having a global identifier (expressed as an
absolute IRI using the
id property) and an
"object type" (expressed using the
property), all instances of the
Object class share a
common set of properties normatively defined by the
While all properties are optional (including the
Object instances SHOULD at least
name (or equivalent
Implementations MUST treat all object types in an Activity Streams document as subclasses of Object unless the object is a Link.
The Activity Vocabulary
defines a broad range of
Object types that are common to
many social Web applications. This specification stops short of
defining semantically specific properties for most of these objects.
External vocabularies can be used to express additional detail not
covered by the Activity Vocabulary.
Furthermore, while implementations are free to introduce new types of
Objects beyond those defined by the Activity Vocabulary, interoperability
issues can arise when applications rely too much on extension types that
are not recognized by other implementations. Care should be taken to not
unduly overlap with or duplicate the existing Object types. For instance,
some vocabularies (e.g. The Good Relations Vocabulary) define their own
classes for describing locations. An implementation that wishes, for
example, to use a
as an object type SHOULD identify the object as being both a
Place and an
illustrated in the following:
Certain properties defined by some External Vocabularies can overlap or duplicate those defined by the Activity Vocabulary. Where such overlap exists, for the sake of consistent interoperability, implementations MUST favor the use of properties defined by the Activity Vocabulary.
Actor objects are specializations of the base Object
type that represent entities capable of carrying out an
Activity. The Actor class is the base class for all
Actor objects. The Activity
Vocabulary provides the normative definition of five specific
types of Actors:
This specification intentionally defines Actors in only the most
generalized way, stopping short of defining semantically specific
properties for each. All Actor objects are specializations of
Object and inherit all of the core properties
common to all Objects. External vocabularies can be used to express
additional detail not covered by the Activity Vocabulary. VCard
[[vcard-rdf]] SHOULD be used to provide additional metadata for
and Organization instances.
While implementations are free to introduce new types of Actors beyond
those defined by the Activity Vocabulary, interoperability issues can
arise when applications rely too much on extension types that are not
recognized by other implementations. Care should be taken to not unduly
overlap with or duplicate the existing Actor types. For instance, some
vocabularies (e.g. VCard) define their own classes for describing
people. An implementation that wishes, for example, to use a
vcard:Individual as an Actor SHOULD identify that Actor as
being both a
vcard:Individual, as illustrated in the previous
Activity objects are specializations of the base Object type that provide information about actions that have either already occurred, are in the process of occurring, or may occur in the future.
In addition to common properties supported by all Object
Activity objects support the following
additional properties defined by the
type property is used to identify the type
of action the Activity Statement represents.
The Activity Vocabulary
defines a small number of
Activity types that are common
to many social Web applications. This specification stops short of
defining semantically specific properties for most of these activities.
External vocabularies can be used to express additional detail not
covered by the Activity Vocabulary.
Furthermore, while implementations are free to introduce new types of
Activites beyond those defined by the Activity Vocabulary,
interoperability issues can arise when applications rely too much on
extension types that are not recognized by other implementations. Care
should be taken to not unduly overlap with or duplicate the existing
Activity types. For instance, some vocabularies (e.g. Schema.org) define
their own classes for describing actions. An implementation that wishes,
for example, to use
as an Activity SHOULD identify that Object as being both a
http://schema.org/LikeAction, as illustrated in the
Implementations are free to use Activity objects in both passive and imperative operations. In the passive sense, the Activity is used to record that an activity has or is occurring. In the imperative sense, the Activity can be used as a form of command, instructing an application to modify state in some manner consistent with the action being described. However, because this specification does not define a normative processing model that constrains how applications make use of the format, the distinction about whether an Activity statement is to be interpreted as a passive notification or as an imperative command can vary across implementations.
Collection objects are a specialization of the
Object that serve as a container for other
Objects or Links.
In addition to the base properties inherited by all
Collection types contain the additional properties:
The items within a
Collection can be ordered or
OrderedCollection type can be
used to identify a Collection whose items are always ordered. In the
JSON serialization, the unordered items of a Collection are
represented using the
items property while ordered items
are represented using the
A Collection can contain a large number of items. Often, it becomes
impractical for an implementation to serialize every item contained
by a Collection using the
orderedItems) property alone. In such cases, the items
within a Collection can be divided into distinct subsets or "pages".
A page is identified using the
CollectionPage type extends from the base
Collection type and inherits all of it's
properties. The following additional properties can also be
partOf property identifies the
Collection to which the items contained by the
current properties are used
to reference other
that contain additional subsets of items from the parent collection.
Collection objects, the items within a
CollectionPage might be ordered or unordered.
OrderedCollectionPage type can be used
to identify a page whose items are strictly ordered.
OrderedCollectionPage type extends from
OrderedCollection. In addition to the properties
inherited from each of those, the
may contain an additional
startIndex property whose value indicates the relative index position
of the first item contained by the page within the
OrderedCollection to which the page belongs.
Whether ordered or not, the pages of a
typically arranged in a sequence (either a singly or doubly-linked
first property is used to identify the first
page in this sequence, while the
last property is used
to identify the final page in the sequence. The
next properties identify the pages immediately before
and immediately following, respectively.
current property identifies a page
containing the subset of items in the
have been created or updated most recently.
The values for the
properties can be either a single
Link referencing a separate resource
Using paging with an
OrderedCollection can be tricky
because there are no guarantees that implementations will process the
sequence of pages in any predictable order. Implementations that wish
to reconstruct the appropriate complete ordering of member items in
the logical collection should navigate to the first (or last)
page in the sequence then recursively follow the
prev) link until all pages have been processed.
If the pages of an
OrderedCollection are not instances
OrderedCollectionPage, an implementation will have
no reliable means of reconstructing the appropriate ordering of items.
Several properties defined by the
Vocabulary are defined
as having natural language values. These are human-readable strings using one or more languages. Within the JSON serialization, they are
expressed as either (1) a single JSON string or (2) a JSON object
mapping well-formed [[RFC5646]] Language-Tags to localized, equivalent
translations of the same string value. In the serialized JSON, these
two forms are differentiated using a simple property naming convention,
for instance: "
name" identifies the JSON string
form for the
property while "
nameMap" represents the object form.
Every key in the object form MUST be a well-formed [[RFC5646]] Language-Tag. The associated values MUST be strings.
The Activity Vocabulary
defines three properties that use natural language values:
Accordingly, in the JSON serialization, the terms
summary", and "
represent the JSON string forms; and the terms
contentMap" for representing the object forms.
The special language tag
"und" can be used within the
object form to explicitly identify a value whose
language is unknown or undetermined.
The default language for document or an individual object can be
established using the [[JSON-LD]]
@context definition. For instance:
Because using this mechanism to establish the default language context requires the use of [[JSON-LD]] mechanisms, support is optional for implementations. However, no other mechanism for establishing the default language context for the document is defined.
In Activity Streams 2.0, an "extension" is any property not defined by the Activity Vocabulary. Consuming implementations that encounter unfamiliar extensions MUST NOT stop processing or signal an error and MUST continue processing the items as if those properties were not present. Note that support for extensions can vary across implementations and no normative processing model for extensions is defined. Accordingly, implementations that rely too heavily on the use of extensions may experience reduced interoperability with other implementations.
For extensions, [[JSON-LD]] is used as the primary mechanism for defining and disambiguating extensions. Implementations that wish to fully support extensions SHOULD use [[JSON-LD]] mechanisms.
It is important to note that the JSON-LD Processing Algorithms [[JSON-LD-API]], as currently defined, will silently ignore any property not defined in a JSON-LD @context. Implementations that publish Activity Streams 2.0 documents containing extension properties SHOULD provide a @context definition for all extensions.
It is also important to note that there are valid JSON constructs which
cannot be used within a JSON-LD document. For instance, JSON-LD forbids
"arrays of arrays" as used, for example, by the popular
GeoJSON specification. While
implementations are free to use such constructs as extensions within an
Activity Streams 2.0 document, consumers that use the standard JSON-LD
Processing Algorithms will be required to either ignore such extensions
or map those to alternative compatible constructs prior to applying the
JSON-LD algorithms. Simple GeoJSON Points, for instance, can be mapped
objects, while more complex geometries can be converted to
"Well-Known Text" representations as illustrated in the non-normative
The JSON-LD syntax supports the use of "Compact URIs" (or CURIE's for
short) [[!curie]]. A "Compact URI" is an alternative encoding of a URI that uses
a defined prefix to simplify serialization. For instance, the URI
http://www.w3.org/ns/activitystreams#Create can be
as:Create by assigning the
prefix the value of
Within JSON-LD, Compact URI prefixes are defined within the JSON-LD
@context definition. For example:
In this example, both the property name
term and the value
ex:Foo are Compact URIs. The property name
http://example.org/term and the value
ex:Foo expands to
In JSON-LD, Compact URI expansion of values applies to
properties explicitly defined as
"type": "id" in the
@context definition. Specifically, Compact URIs can be used
anywhere an IRI (or URI) value is expected.
Activity Streams 2.0 implementations that wish to fully support extensions
MUST support Compact URI expansion as defined by the JSON-LD specification.
Such expansion applies to all property names as well as all property values
explicitly defined as type
id in the normative
For example, in the JSON-LD serialization, the property name
name expands, and is equivalent, to
While support for Compact URI's is required, over reliance on the
compact form can lead to ambiguity and interoperability issues between
implementations. Therefore, Compact URI use SHOULD be avoided
in all cases other than property names and the value(s) of the
Implementations that parse and then reserialize Activity Streams 2.0 documents that contain extension properties SHOULD take sufficient care to ensure that extension properties used within the original document are preserved and serialized appropriately.
For instance, consider the following simple Activity Stream object
foo extension is defined within the
@context while the
property is not.
An implementation that receives this Note object can choose to parse the object as an ordinary JSON object or it can use the standard JSON-LD Expansion algorithm.
If the implementation chooses to parse the object as ordinary JSON
and then reserializes the object (e.g. for storage or redistribution),
then it would simply preserve the values of the
bar properties as they are and
include those in the reserialized output.
However, if the implementation chooses to use the JSON-LD expansion
@context will be removed from the expanded
result and the
bar property will be mapped to the
_:bar. If this document is then reserialized
using the normative Activity Streams 2.0 context, the JSON-LD
compacted form would be:
While this is close to the original, the use of fully expanded URI
label for the
foo property is not ideal. To ensure that
the reserialized object is serialized correctly, implementations that
perform JSON-LD expansion of received documents SHOULD preserve the
@context used when performing the JSON-LD
expansion, then reuse that when reserializing the object into the
JSON-LD compacted form.
Publishers or Consumers implementing Activity Streams as a stream of public data may also want to consider the potential for unsolicited commercial or malicious content and should take preventative measures to recognize such content and either identify it or not include it in their implementations.
Publishers should take reasonable measures to ensure potentially malicious user input such as cross-site scripting attacks are not included in the Activity Streams data they publish.
Consumers that re-emit ingested content to end-users MUST take reasonable measures if emitting ingested content to make sure potentially malicious ingested input is not re-emitted.
Consumers that re-emit ingested content for crawling by search engines should take reasonable measures to limit any use of their site as a Search Engine Optimization loophole. This may include converting untrusted hyperlinks to text or including a rel="nofollow" attribute.
Consumers should be aware of the potential for spoofing attacks where the attacker publishes activities or objects with falsified property values with the intent of injecting malicious content, hiding or corrupting legitimate content, or misleading users.
Activity Streams are JSON Documents and are subject to the same security considerations described in [[!RFC7159]].
Activity Streams implementations handle URIs. See Section 7 of [[!RFC3986]].
Activity Streams implementations handle IRIs. See Section 8 of [[!RFC3987]].
This specification registers the
application/activity+json MIME Media Type specifically for identifying documents
conforming to the Activity Streams 2.0 format.
profile: The profile parameter for the application/activity+json
media type allows one or more profile URIs to be specified. These
profile URIs have the identifier semantics defined in [[!RFC6906]].
The "profile" media type parameter MUST be quoted. It contains a
non-empty list of space-separated URIs (the profile URIs).
profile-param = "profile=" profile-value profile-value = <"> profile-URI 0*( 1*SP profile-URI ) <"> profile-URI = URIThe "URI" in the above grammar refers to the "URI" as defined in Section 3 of [[!RFC3986]].
Resources that use the "
|Security considerations:||As defined in this specification.|
|Contact:||James M Snell <firstname.lastname@example.org>|
Note that while the Activity Streams 2.0 format uses JSON-LD conventions, there are a number of constraints and additional requirements for Activity Streams 2.0 implementations that justify the use of a specific media type.
Because Activity Streams 2.0 can be considered a restricted profile of JSON-LD, Implementations SHOULD consider the `application/ld+json; profile="http://www.w3.org/ns/activitystreams"` media type as being equivalent to `application/activity+json`.
The author wishes to thank the Activity Streams community and implementers for their support, encouragement, and enthusiasm including but not limited to: Abdul Qabiz, Adina Levin, Adrian Chan, Adriana Javier, Alan Hoffman, Alex Kessinger, Alexander Ovchinnikov, Alexander Zhuravlev, Alexandre Loureiro Solleiro, Amy Walgenbach, Andres Vidal, Angel Robert Marquez, Ari Steinberg, Arjan Scherpenisse, Arne Roomann-Kurrik, Beau Lebens, Ben Hedrington, Ben Metcalfe, Ben Werdmuller, Benjamin Goering, Bill de hOra, Bo Xing, Bob Aman, Bob Wyman, Brett Slatkin, Brian Walsh, Brynn Evans, Charlie Cauthen, Chris Chabot, Chris Messina, Chris Toomey, Christian Crumlish, Dan Brickley, Dan Scott, Daniel Chapman, Danny Ayers, Dare Obasanjo, Darren Bounds, David Cramer, David Nelson, David Recordon, DeWitt Clinton, Douglas Pearce, Ed Summers, Elias Bizannes, Elisabeth Norris, Eric Marcoullier, Eric Woods, Evan Prodromou, Gee-Hsien Chuang, Greg Biggers, Gregory Foster, Henry Saputra, Hillary Madsen, Howard Liptzin, Hung Tran, Ian Kennedy, Ian Mulvany, Ivan Pulleyn, Jacob Kim, James Falkner, James Pike, James Walker, Jason Kahn, Jason Kantz, Jeff Kunins, Jeff Martin, Jian Lin, Johannes Ernst, John Panzer, Jon Lebkowsky, Jon Paul Davies, Jonathan Coffman, Jonathan Dugan, Joseph Boyle, Joseph Holsten, Joseph Smarr, Josh Brewer, Jud Valeski, Julien Chaumond, Julien Genestoux, Jyri Engestroem, Kaliya Hamlin, Kevin Marks, Laurent Eschenauer, Laurie Voss, Leah Culver, Libby Miller, Manu Mukerji, Mark Weitzel, Marko Degenkolb, Marshall Kirkpatrick, Martin Atkins, Martin Svensson, Marty Alchin, Mary Hoder, Matt Leventi, Matt Wilkinson, Matthias Mueller-Prove, Max Engel, Max Wegmueller, Melvin Carvalho, Michael Buckbee, Michael Chan, Michael Richardson, Michael Sullivan, Mike Macgirvin, Mislav Marohnić, Mo Jangda, Monica Wilkinson, Nate Benes, NeilFred Picciotto, Nick Howard, Nick Lothian, Nissan Dookeran, Nitya Narasimhan, Pablo Martin, Padraic Brady, Pat Cappelaere, Patrick Aljord, Peter Ferne, Peter Reiser, Peter Saint-Andre, Phil Wolff, Philip (flip) Kromer, Richard Cunningham, Richard Zhao, Rick Severson, Robert Hall, Robert Langbert, Robert Dolin, Robin Cover, Ryan Boyd, Sam Sethi, Scott Raymond, Scott Seely, Simon Grant, Simon Wistow, Stephen Garcia, Stephen Sisk, Stephen Paul Weber, Steve Ivy, Steve Midgley, Steven Livingstone-Perez, Sylvain Carle, Sylvain Hellegouarch, Tantek Çelik, Tatu Saloranta, Tim Moore, Timothy Young, Todd Barnard, Tosh Meston, Tyler Gillies, Will Norris, Zach Copley, Laurent-Walter Goix, Matthew Marum, Andy Smith, and Zach Shepherd.
While the syntax defined by this specification diverges from that defined by JSON Activity Streams 1.0, the fundamental model defined by that original specification remains intact. Specific processing rules are defined by this specification that allow existing Activity Streams 1.0 documents to be mapped to and processed as an Activity Streams 2.0 document.
The JSON syntax defined by this specification differs somewhat from that defined in the original JSON Activity Streams 1.0 [[!AS1]] specification in ways that are not backwards compatible. Implementations can choose to continue supporting the JSON Activity Streams 1.0 syntax but ought consider it to be deprecated. This means that while implementations can continue to consume the 1.0 syntax, they should not output the 1.0 syntax unless specifically interacting with older non-2.0 compliant implementations.
application/stream+json" MIME media type when producing a JSON serialization using the Activity Streams 1.0 syntax, and "
application/activity+json" when producing a serialization conforming to the 2.0 syntax.
application/stream+json" or the more generic "
application/json" MIME media type MUST follow the syntax and processing rules set by [[!AS1]]. The 2.0 syntax and processing rules apply only when handling serializations using the "
application/activity+json" media type.
idas an alias for the JSON-LD
@idkey word; and the
verbproperties as aliases for the JSON-LD
displayNameproperty which has been renamed to
namein Activity Streams 2.0. Implementations ought to treat
displayNameas an alias for
titleproperty which has been dropped from Activity Streams 2.0. Implementations processing Activity Streams 1.0 documents as Activity Streams 2.0 ought to treat instances of the
titleproperty as an extension.
summaryproperties as natural language values which means their values can be expressed as either a string or an object mapping language tags to string values. In the 1.0 syntax, these are expressed solely as String values. Because the 1.0 values are a valid subset allowed by this specification, implementations are not required to take any specific action to continue supporting those values.
downstreamDuplicatesproperties defined by Activity Streams 1.0 and does not provide a replacement. This is due largely to lack of any reasonable implementation evidence. While the
downstreamDuplicatesproperties MAY continue to be used, implementations SHOULD avoid them.
post" verb was defined to describe the action of both creating an object and "posting" or uploading it to a service. This specification replaces the "
post" verb with separate
AddActivity types. When processing Activity Streams 1.0 documents and converting those into 2.0, implementations SHOULD treat instances of the "
post" verb as equivalent to
Createif there is no
targetproperty specified; and equivalent to
Addif there is a
By following these guidelines, all JSON Activity Streams 1.0 serializations can be processed successfully by 2.0 implementations.
It is possible use multiple vocabularies to cover particular characteristics of the activities like data provenance and annotations, which can compliment the Activity Vocabulary. For example: Eric writes a short note to be shared with his followers. After posting the note, he notices a spelling error. He edits the note and re-posts it. Later, Eric decides that the information in the note is incorrect. He deletes the note.