My FeedDiscussionsHashnode Enterprise
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
The batch verb

The batch verb

Muralidharan's photo
Muralidharan
·Mar 13, 2021·

1 min read

Introduction

The batch verb in the @protocol allows multiple @protocol commands to be sent in a single call to the secondary server. Developers of @pps can leverage the batch feature to send multiple commands, thereby reducing the number of network calls from the device to the secondary server.

1. Usage

1.1 Sample Request

[{"id":1,"command":"update:public:phone@alice +1 111 1111”},
{"id":2,"command":"update:@alice:phone@alice +1 222 2222”},
{"id":3,"command":"delete:public:phone@alice”}]

1.2 Sample Response

data:[{"id":1,"response":{"data":10}},
     {"id":2,"response":{"data":11}},
     {"id":3,"response":{"data":12}}]

2.1 Invalid command in batch

[{"id":1,"command":"update:public:phone@alice +1 111 1111”},
{"id":2,"command":"update:@alice:phone@alice”}]

2.2 Sample error response

data:[[{"id":1,"response":{"data":13}}, {"id":2,"response":{"error_code":"AT0003","error_message":"Invalid syntax"}}]

Refer to the BatchVerbHandler to learn more about this verb.

Coming Soon

The batch verb has not yet been exposed in our SDK . We plan to do that soon.