Skip to content

Commit

Permalink
readme notes
Browse files Browse the repository at this point in the history
  • Loading branch information
michelson committed Sep 12, 2023
1 parent c15a105 commit 0ce6a49
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,48 +86,4 @@ Let's first ensure that the Sinatra app is running:

2. Visit `http://localhost:4567/` in your browser to confirm that the app is running.

Now, there are a few ways to interact with the application:

### 1. Using `curl`

**Sending an Activity to Outbox**:
Let's send a "Note" type activity to our actor's outbox which should forward it to another actor's inbox.
```bash
curl -X POST -d "inbox_url=http://recipient.com/actors/2/inbox" -d "activity_data={\"type\":\"Note\",\"content\":\"Hello from Sinatra!\"}" http://localhost:4567/actors/1/outbox
```
**Receiving an Activity in Inbox**:
You can simulate another actor sending an activity to our actor's inbox:

```bash
curl -X POST -H "Content-Type: application/json" -d "{\"type\":\"Note\",\"content\":\"Hello to Sinatra from another actor!\"}" http://localhost:4567/actors/1/inbox
```

### 2. Using a Web Browser

You can easily check the root endpoint by navigating to `http://localhost:4567/` in your browser. However, for POST requests like the outbox and inbox interactions, you'll need a tool more suited for the task.
### 3. Using Postman
[Postman](https://www.postman.com/) is a popular tool for testing API endpoints.
1. **Sending an Activity to Outbox**:
- Set the method to `POST`.
- URL: `http://localhost:4567/actors/1/outbox`
- Set the headers:
- `Content-Type: application/x-www-form-urlencoded`
- In the body, select `x-www-form-urlencoded` and add two keys:
- `inbox_url` with the value `http://recipient.com/actors/2/inbox`
- `activity_data` with the value `{"type":"Note","content":"Hello from Sinatra!"}`
- Click on "Send".
2. **Receiving an Activity in Inbox**:
- Set the method to `POST`.
- URL: `http://localhost:4567/actors/1/inbox`
- Set the headers:
- `Content-Type: application/json`
- In the body, select `raw` and paste in `{"type":"Note","content":"Hello to Sinatra from another actor!"}`
- Click on "Send".
**Note**: As this example is highly simplified, it doesn't handle potential errors or specific responses you'd expect from a fully-fledged ActivityPub service. Ensure that any production implementation follows the ActivityPub specification closely and manages potential risks.

0 comments on commit 0ce6a49

Please sign in to comment.