Create room reservations using Domino data services REST API

心不动则不痛 提交于 2019-12-02 02:35:40

I recommend registering a special "user" to act as the booking agent. Then you can use the calendar API to book any room. I think this approach will work better than the data API.

Details:

  • Register a new "user" to act as the booking agent. Let's call the user "Room Agent/MyCorp". The user's mail file is "mail/ragent.nsf".

  • Make sure the calendar API is enabled on a mail server with a replica of "mail/ragent.nsf".

  • When someone uses your tablet app to book a room, the app sends a request to create an event on the room agent's calendar (POST /mail/ragent.nsf/api/calendar/events). The new event should include the room in the list of attendees.

  • The calendar API sends an invitation to the room (actually the resource database). As long as the room is not already booked, the resource database accepts the invitation and the room becomes busy for that time slot.

This saves you from having to deal with the data API and the intricacies of the resource database. Your tablet app just needs to know the mail server host name, the name of the mail file, and the room agent's credentials. I also like the idea of being able to "audit" all bookings originating from your tablet app. You'll be able to find all the events and notices (accept or decline) in the room agent's mail file.

One disadvantage is booking will not be instantaneous, but the resource database should be able to accept an invitation in a matter of seconds.

By the way, here is some sample JSON input for your POST request:

{
  "events":[
    {
      "summary":"Calendar API test",
      "location":"test",
      "description":"test",
      "start":{"date":"2018-01-01","time":"13:00:00","utc":true},
      "end":{"date":"2018-01-01","time":"14:00:00","utc":true},
      "organizer":{"email":"ragent@mycorp.com"},
      "attendees":[
        {
          "role":"req-participant",
          "userType":"room",
          "status":"needs-action",
          "rsvp":true,
          "email":"room@mycorp.com"
        }
      ]
    }
  ]
}

It's important to specify "userType":"room" for the attendee. Otherwise, the resource database won't accept the invitation.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!