BusyBird

 view release on metacpan or  search on metacpan

lib/BusyBird/Manual/WebAPI.pod  view on Meta::CPAN

Request Body:

    {
      "max_id": "http://example.com/page/2013/0202",
      "ids": [
        "http://example.com/page/2013/0204"
       ]
    }

Response Body:

    {"error": null, "count": 2}


=head2 POST /timelines/{timeline}/statuses.json

Adds new statuses to the specified timeline.

This endpoint uses L<BusyBird::Timeline>'s C<add_statuses()> method.
Therefore, it applies the status filter to the input statuses, and it generates C<id> and C<created_at> fields if they don't exist.

B<Path Parameters>

=over

=item C<timeline> = STR (required)

Timeline name.

=back

B<Request Body>

A status object or an array of status objects in JSON format.

See L<BusyBird::Manual::Status> for the structure of status objects.

B<Response>

The response is a JSON object.

In success, the HTTP response code is 200.
C<error> attribute of the response object is C<null> and C<count> attribute is the number of statuses added.

In failure, the HTTP response code is 4** or 5**.
C<error> attribute of the response object is non-null and it describes the error.

B<Example>

Request URL:

    POST /timelines/home/statuses.json

Request Body:

    [
      {
        "id": "http://example.com/page/2013/0204",
        "created_at": "Mon Feb 04 11:02:45 +0900 2013",
        "text": "content of the status",
        "busybird": { "level": 3 }
      },
      {
        "id": "http://example.com/page/2013/0202",
        "created_at": "Sat Feb 02 17:38:12 +0900 2013",
        "text": "another content"
      }
    ]

Response Body:

    {"error": null, "count": 2}


=head2 GET /timelines/{timeline}/updates/unacked_counts.json

Watches updates in numbers of unacked statuses (i.e. unacked counts) in the specified timeline, and gets them when necessary.

This is an endpoint for long-polling (Comet) access.
The response is delayed until the current unacked counts are different
from the unacked counts given in the query parameters.


B<Path Parameters>

=over

=item C<timeline> = STR (required)

Timeline name.

=back

B<Query Parameters>

The query parameters specify the assumed unacked counts.
As long as the current unacked counts are the same as the assumed unacked counts,
the response is delayed.

The assumed unacked counts can be specified per status level and/or in total.

=over

=item C<total> = NUM (optional)

Specifies the total number of unacked statuses in the timeline.

=item C<{level}> = NUM (optional)

Specifies the number of unacked statuses in the status level of C<{level}>.
C<{level}> can be any integer.

=back

B<Response>

The response is a JSON object.

In success, the HTTP response code is 200.
C<error> attribute of the response object is C<null> and
C<unacked_counts> attribute is an object describing the current unacked counts (See Example).



( run in 0.627 second using v1.01-cache-2.11-cpan-39bf76dae61 )