What could be the reason that my update activity does not work?

What could be the reason that my update activity does not work? I use the same code for the signature as for the creation and deletion.

I ran a Delete Activity after the update attempt.

The Update Activity json code looked the same in the log file as the Delete Activity json code (except for the words Update and Delete for the type). The Delete worked immediately.

Both times I got the following response from the server: HTTP/1.1 100 Continue

Any help is very welcome.

{
   "@context":"https:\/\/www.w3.org\/ns\/activitystreams",
   "id":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json&id=63c3f6255a1f1",
   "type":"Update",
   "actor":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json",
   "to":[
      "https:\/\/www.w3.org\/ns\/activitystreams#Public"
   ],
   "cc":[
      "https:\/\/mastodon.social\/users\/astridx"
   ],
   "object":{
      "@context":{
         "@language":"de-DE"
      },
      "id":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json&id=143",
      "type":"Note",
      "published":"2023-01-15T12:13:00+00:00",
      "attributedTo":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json",
      "to":[
         "https:\/\/www.w3.org\/ns\/activitystreams#Public"
      ],
      "cc":[
         "https:\/\/mastodon.social\/users\/astridx"
      ],
      "content":"<b>Antworten von ChatGPT zur Frage: Was ist Joomla?<\/b><br><p>Die ganze Welt spricht derzeit \u00fcber den neuen Chatbot von OpenAI: ChatGPT. ChatGPT kann von jedem kostenlos genutzt werden. Ich habe dies im Joomla Kontext getestet.<\/p>\r\n<p>#ChatGPT #Joomla<\/p>\r\n<p>https:\/\/ug-mayen.de\/joomla-blog-de\/143-antworten-von-chatgpt-zur-frage-was-ist-joomla<\/p>\r\n"
   }
}
1 Like

100 Continue indicates that the server processed your headers, but you haven’t yet sent the body. What server are you testing this against? I’m not aware of any situation where any existing implementation would send this response (e.g. I’ve never seen it from Pleroma/Mastodon). Unless you’re using the Expect: 100-continue header in your request, which might trigger nginx to send it automatically?

Anyway, I’m not sure what specifically might trigger a Delete that works and an Update that doesn’t, you’d have to debug with the individual implementation you’re trying to send these activities to. Maybe they don’t support Updates?

2 Likes

Thank you very much for your feedback. I am testing with my account on https://mastodon.social.

Create:

2023-01-16T11:36:34+00:00
{
   "@context":"https:\/\/www.w3.org\/ns\/activitystreams",
   "id":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json&id=63c536c262dce",
   "type":"Create",
   "actor":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json",
   "to":[
      "https:\/\/www.w3.org\/ns\/activitystreams#Public"
   ],
   "cc":[
      "https:\/\/mastodon.social\/users\/Astridx"
   ],
   "object":{
      "@context":{
         "@language":"en"
      },
      "id":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json&id=156",
      "type":"Note",
      "attachment":{
         "type":"Image",
         "mediaType":"image\/png",
         "url":"https:\/\/ug-mayen.de\/images\/maennchen.png"
      },
      "url":"https:\/\/ug-mayen.de\/administrator\/index.php?option=com_content&amp;view=article&amp;id=156&amp;catid=10&amp;lang=en-GB",
      "published":"2023-01-16T11:35:41+00:00",
      "attributedTo":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json",
      "to":[
         "https:\/\/www.w3.org\/ns\/activitystreams#Public"
      ],
      "cc":[
         "https:\/\/mastodon.social\/users\/Astridx"
      ],
      "content":"An english test article<br><p>Testcontent<\/p><br><a href=\"https:\/\/ug-mayen.de\/administrator\/index.php?option=com_content&amp;view=article&amp;id=156&amp;catid=10&amp;lang=en-GB\">https:\/\/ug-mayen.de\/administrator\/index.php?option=com_content&amp;view=article&amp;id=156&amp;catid=10&amp;lang=en-GB<\/a>"
   }
}

Udate did not work:

2023-01-16T11:47:40+00:00
{
   "@context":"https:\/\/www.w3.org\/ns\/activitystreams",
   "id":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json&id=63c5395cde737",
   "type":"Update",
   "actor":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json",
   "to":[
      "https:\/\/www.w3.org\/ns\/activitystreams#Public"
   ],
   "cc":[
      "https:\/\/mastodon.social\/users\/Astridx"
   ],
   "object":{
      "@context":{
         "@language":"en"
      },
      "id":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json&id=156",
      "type":"Note",
      "attachment":{
         "type":"Image",
         "mediaType":"image\/png",
         "url":"https:\/\/ug-mayen.de\/images\/maennchen.png"
      },
      "url":"https:\/\/ug-mayen.de\/administrator\/index.php?option=com_content&amp;view=article&amp;id=156&amp;catid=10&amp;lang=en-GB",
      "published":"2023-01-16T11:35:41+00:00",
      "attributedTo":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json",
      "to":[
         "https:\/\/www.w3.org\/ns\/activitystreams#Public"
      ],
      "cc":[
         "https:\/\/mastodon.social\/users\/Astridx"
      ],
      "content":"A changed english test article<br><p>Testcontent<\/p><br><a href=\"https:\/\/ug-mayen.de\/administrator\/index.php?option=com_content&amp;view=article&amp;id=156&amp;catid=10&amp;lang=en-GB\">https:\/\/ug-mayen.de\/administrator\/index.php?option=com_content&amp;view=article&amp;id=156&amp;catid=10&amp;lang=en-GB<\/a>"
   }
}

Delete worked:

2023-01-16T11:54:27+00:00
{
   "@context":"https:\/\/www.w3.org\/ns\/activitystreams",
   "id":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json&id=63c53af3e69f7",
   "type":"Delete",
   "actor":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json",
   "to":[
      "https:\/\/www.w3.org\/ns\/activitystreams#Public"
   ],
   "cc":[
      "https:\/\/mastodon.social\/users\/Astridx"
   ],
   "object":{
      "@context":{
         "@language":"en"
      },
      "id":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json&id=156",
      "type":"Note",
      "attachment":{
         "type":"Image",
         "mediaType":"image\/png",
         "url":"https:\/\/ug-mayen.de\/images\/maennchen.png"
      },
      "url":"https:\/\/ug-mayen.de\/administrator\/index.php?option=com_content&amp;view=article&amp;id=156&amp;catid=10&amp;lang=en-GB",
      "published":"2023-01-16T11:35:41+00:00",
      "attributedTo":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json",
      "to":[
         "https:\/\/www.w3.org\/ns\/activitystreams#Public"
      ],
      "cc":[
         "https:\/\/mastodon.social\/users\/Astridx"
      ],
      "content":"A changed english test article<br><p>Testcontent<\/p><br><a href=\"https:\/\/ug-mayen.de\/administrator\/index.php?option=com_content&amp;view=article&amp;id=156&amp;catid=10&amp;lang=en-GB\">https:\/\/ug-mayen.de\/administrator\/index.php?option=com_content&amp;view=article&amp;id=156&amp;catid=10&amp;lang=en-GB<\/a>"
   }
}

I send to https://mastodon.social/inbox/

I set this options in my PHP Code:

curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	
$server_output = curl_exec($ch);

Each time I get something like that back. Which doesn’t really help me.

HTTP/1.1 100 Continue

HTTP/1.1 202 Accepted
Date: Mon, 16 Jan 2023 11:54:28 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Server: Mastodon
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Permissions-Policy: interest-cohort=()
Cache-Control: no-cache
Content-Security-Policy: base-uri 'none'; default-src 'none'; frame-ancestors 'none'; font-src 'self' https://static-cdn.mastodon.social; img-src 'self' https: data: blob: https://static-cdn.mastodon.social; style-src 'self' https://static-cdn.mastodon.social 'nonce-cRWWA35x2Nv6SssRHyQ0nA=='; media-src 'self' https: data: https://static-cdn.mastodon.social; frame-src 'self' https:; manifest-src 'self' https://static-cdn.mastodon.social; connect-src 'self' data: blob: https://static-cdn.mastodon.social https://files.mastodon.social wss://mastodon.social; script-src 'self' https://static-cdn.mastodon.social 'wasm-unsafe-eval'; child-src 'self' blob: https://static-cdn.mastodon.social; worker-src 'self' blob: https://static-cdn.mastodon.social
X-Request-Id: 41b8d81d-6f6f-4ba1-aea9-7296d23e0e07
X-Runtime: 0.019107
Strict-Transport-Security: max-age=63072000; includeSubDomains

Which also doesn’t work: The language is not recognised. At least, no translation is offered to me. In other posts, I see a link for English texts that offers me a translation. I found the solution. I need to use contentMap.

Here is a post that is still active.

{
   "@context":"https:\/\/www.w3.org\/ns\/activitystreams",
   "id":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json&id=63c543d16e0f0",
   "type":"Create",
   "actor":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json",
   "to":[
      "https:\/\/www.w3.org\/ns\/activitystreams#Public"
   ],
   "cc":[
      "https:\/\/mastodon.social\/users\/Astridx"
   ],
   "object":{
      "@context":{
         "@language":"en"
      },
      "id":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json&id=157",
      "type":"Note",
      "attachment":{
         "type":"Image",
         "mediaType":"image\/png",
         "url":"https:\/\/ug-mayen.de\/images\/maennchen.png"
      },
      "url":"https:\/\/ug-mayen.de\/",
      "published":"2023-01-16T12:31:49+00:00",
      "attributedTo":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json",
      "to":[
         "https:\/\/www.w3.org\/ns\/activitystreams#Public"
      ],
      "cc":[
         "https:\/\/mastodon.social\/users\/Astridx"
      ],
      "content":"A new test article<br><p>Objects are the core concept around which both [ActivityStreams] and ActivityPub are built. Objects are often wrapped in Activities and are contained in streams of Collections, which are themselves subclasses of Objects. See the [Activity-Vocabulary] document, particularly the Core Classes; ActivityPub follows the mapping of this vocabulary very closely.<\/p><br><a href=\"https:\/\/ug-mayen.de\/\">https:\/\/ug-mayen.de\/<\/a>"
   }
}

I am sure that if I call a delete now, the post will be deleted. The update did not work:

{
   "@context":"https:\/\/www.w3.org\/ns\/activitystreams",
   "id":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json&id=63c543fb8d88a",
   "type":"Update",
   "actor":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json",
   "to":[
      "https:\/\/www.w3.org\/ns\/activitystreams#Public"
   ],
   "cc":[
      "https:\/\/mastodon.social\/users\/Astridx"
   ],
   "object":{
      "@context":{
         "@language":"en"
      },
      "id":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json&id=157",
      "type":"Note",
      "attachment":{
         "type":"Image",
         "mediaType":"image\/png",
         "url":"https:\/\/ug-mayen.de\/images\/maennchen.png"
      },
      "url":"https:\/\/ug-mayen.de\/",
      "published":"2023-01-16T12:31:49+00:00",
      "attributedTo":"https:\/\/ug-mayen.de\/index.php?option=com_activitypubs&view=Profil&format=json",
      "to":[
         "https:\/\/www.w3.org\/ns\/activitystreams#Public"
      ],
      "cc":[
         "https:\/\/mastodon.social\/users\/Astridx"
      ],
      "content":"A changed new test article<br><p>Objects are the core concept around which ry closely.<\/p><br><a href=\"https:\/\/ug-mayen.de\/\">https:\/\/ug-mayen.de\/<\/a>"
   }
}

Mastodon requires the updated timestamp field to be present on updated statuses, to prevent conflicts and race conditions where two “Update” payloads get sent out and the receiving server doesn’t know which one to use. You can see this requirement here: mastodon/process_status_update_service.rb at d66dfc7b3c1b62a0d5276387ea8745da598afacc · mastodon/mastodon · GitHub

I’m not sure if this is documented anywhere, but I’ll look into it and see if I can update the documentation accordingly

1 Like

I’ve submitted a PR to document this requirement: Document requirement for `updated` timestamp on statuses when processing Update activity by nightpool · Pull Request #1150 · mastodon/documentation · GitHub

1 Like

Thank you very much. The update now also works with the additional parameter.