With ActivityPub, what is a valid and preferred way to export a Person with an Outbox?

50 Views Asked by At

I want to create a single JSON-LD file that represents an export of a person and their list of statuses. There is no target system for import right now, but I would like it to be in line with current ActivityPub best practices. The following is valid in the JSON-LD Playground, but is it the most logical form? Also, should the Outbox have the oldest item first or last?

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "@type": "Person",
  "@id": "https://example.com/user1",
  "name": "user1",
  "outbox": {
    "@type": "OrderedCollection",
    "orderedItems": [
      {
        "@type": "Create",
        "object": {
          "@type": "Note",
          "content": "This is the youngest note"
        },
        "published": "2024-01-02T12:00:00Z"
      },
      {
        "@type": "Create",
        "object": {
          "@type": "Note",
          "content": "This is the oldest note"
        },
        "published": "2024-01-01T12:00:00Z"
      }
    ]
  }
}

Edited based on the answer.

1

There are 1 best solutions below

0
On BEST ANSWER
{
 "@context": "https://www.w3.org/ns/activitystreams",
 "@type": "Person",
 "@id": "https://example.com/user1",
 "name": "user1",
 "outbox": {
   "@type": "OrderedCollection",
   "orderedItems": [
  {
    "@type": "Create",
    "object": {
      "@type": "Note",
      "content": "This is the oldest note",
      "published": "2024-01-01T12:00:00Z"
    }
  },
  {
    "@type": "Create",
    "object": {
      "@type": "Note",
      "content": "This is the newest note",
      "published": "2024-01-02T12:00:00Z"
    }
  }
]
}
}

This structure ensures that items in the outbox are kept in an ordered manner by using an OrderedCollection. This is usually preferred in the form of the newest items coming to the top, as social media timelines are often organized in this way.