使用Domino数据服务REST API创建房间预订 [英] Create room reservations using Domino data services REST API

查看:245
本文介绍了使用Domino数据服务REST API创建房间预订的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用Domino数据服务REST API创建房间预订,但是我似乎缺少一个窍门.

I've been attempting to create room bookings using the Domino data services REST API but I seem to be missing a trick.

发送POST请求到文档端点,我能够提交并创建一个预订文档,该文档显示在房间和资源"视图中,但基础房间在Notes客户端中仍然显示为可用.

Sending a POST request to the document endpoint I am able to submit and create a reservation document which appears in the Rooms and resource view but the underlying room still shows as available in the notes client.

以下是请求正文的示例:

Here is a sample of the request body:

   {
  "@authors": [
    "CN=Andrew Jones/O=MyCorp",
    ""
  ],
  "@form": "Reservation",
  "From": "CN=Andrew Jones/O=MyCorp",
  "Chair": "CN=Andrew Jones/O=MyCorp",
  "AltChair": "CN=Andrew Jones/O=MyCorp",
  "Principal": "CN=Andrew Jones/O=MyCorp",
  "SequenceNum": 1,
  "OrgState": "5",
  "ResourceType": "1",
  "ResourceName": "Room/Office",
  "ROOM": "Room/Office@MyCorp",
  "Capacity": 1,
  "AppointmentType": "3",
  "StartTimeZone": "Z=0$DO=1$DL=3 -1 1 10 -1 1$ZX=47$ZN=GMT",
  "EndTimeZone": "Z=0$DO=1$DL=3 -1 1 10 -1 1$ZX=47$ZN=GMT",
  "TOPIC": "Test",
  "SendTo": "CN=Room/O=Office",
  "SelectedRR": "CN=Room/O=Office",
  "$BusyName":"CN=Room/O=Office",
  "Encrypt": "0",
  "Categories": "",
  "RouteServers": "CN=dominonode/O=MyCorp",
  "DeliveredDate": { "data":"2017-03-09T12:38:34Z","type":"datetime"},
  "StartDate": {"data":"2017-03-09T20:00:00Z","type":"datetime"},
  "StartTime": {"data":"2017-03-09T20:00:00Z","type":"datetime"},
  "StartDateTime": {"data":"2017-03-09T20:00:00Z","type":"datetime"},
  "EndDate": {"data":"2017-03-09T21:00:00Z","type":"datetime"},
  "EndTime": {"data":"2017-09-03T21:00:00Z","type":"datetime"},
  "EndDateTime": {"data":"2017-03-09T21:00:00Z","type":"datetime"},
  "CalendarDateTime": {"data":"2017-03-09T20:00:00Z","type":"datetime"},
  "UpdateSeq": 1,
  "Author": "CN=Andrew Jones/O=MyCorp",
  "ResourceOwner": "",
  "ReservedFor": "CN=Andrew Jones/O=MyCorp",
  "ReservedBy": "CN=Andrew Jones/O=MyCorp",
  "RQStatus": "A",
  "Purpose": "API Test",
  "NoticeType": "A",
  "Step": 3,
  "Site": "Office",
  "ReserveDate": {"data":"2017-03-09T20:00:00Z","type":"datetime"}
}

这个问题建议相反,我应该尝试创建一个Calendar事件,但是我发送的所有内容似乎都遭到错误请求的拒绝,包括

This question suggests I should instead be trying to create a Calendar event but everything I send seems to get rejected with bad request, including the sample

我还查看了​​另一个问题,它表明我需要先创建一个约会,然后再为房间创建一个通知文件,但是尽管我可以创建这些文件,但似乎并没有创建预订.

I've also looked at another question which suggests I need to create an appointment and then a notice document for the room, but whilst I can create these documents, it doesn't seem to create a reservation.

有没有人尝试过并使其起作用,或者我只是加入大象的墓地?

Has anyone tried this and got it to work or am I just joining the elephant's graveyard?

推荐答案

我建议注册一个特殊的用户"以充当预订代理.然后,您可以使用日历API预订任何房间.我认为这种方法会比数据API更好.

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.

详细信息:

  • 注册一个新的用户"以充当预订代理.我们称用户"Room Agent/MyCorp".用户的邮件文件为"mail/ragent.nsf".

  • 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".

确保在具有"mail/ragent.nsf"副本的邮件服务器上启用日历API.

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

当某人使用您的平板电脑应用预订房间时,该应用会发送请求,以在房间代理的日历上创建一个事件(POST/mail/ragent.nsf/api/calendar/events).新活动应在与会者列表中包括会议室.

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.

日历API将邀请发送到会议室(实际上是资源数据库).只要尚未预定会议室,资源数据库就会接受邀请,并且该会议室在该时段变得很忙.

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.

这使您不必处理数据API和资源数据库的复杂性.您的平板电脑应用只需知道邮件服务器的主机名,邮件文件的名称以及会议室代理的凭据.我也喜欢能够审核"来自平板电脑应用程序的所有预订的想法.您将可以在会议室代理的邮件文件中找到所有事件和通知(接受或拒绝).

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.

顺便说一下,这是您的POST请求的一些示例JSON输入:

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"
        }
      ]
    }
  ]
}

为与会者指定"userType":"room"很重要.否则,资源数据库将不接受邀请.

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

这篇关于使用Domino数据服务REST API创建房间预订的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆