1

Can not update tapkey grunt. I try to update this tapkey object and got 400 (Bad Request).

{
  active: false
  boundCard: null
  boundCardId: null
  boundLock: {
   targetType: 'Lock'
   id: '...'
   clientRef: null
   physicalLockId: '...' 
   title: 'Vorhängeschloss zum Testen'
   description: null
  },
  boundLockId: "..."
  clientRef: null
  contact: {
    email: '...'
    ipUserName: '...'
    id: '...'
    clientRef: null 
    ownerId: '...'
    ipId: "tapkey"
    comment: null
    isActive: true
    title: null
    ipUserId: null,
    identifier: "..."
  }
  contactId: "..."
  credentialId: null
  customPayload: null
  id: "..."
  keyLifetime: null
  mobileDeviceRef: null
  owner: null
  permissionDetails: null
  state: "Expired"
  timeRestrictionIcal: null
  validBefore: "2023-03-04T23:00:00.000Z"
  validFrom: "2023-03-03T23:00:00.000Z"
}

with this new grint object:

{
  boundLockId: "..."
  contactId: ""
  timeRestrictionIcal:
"BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:http://localhost:3000\nBEGIN:VEVENT\nUID:20230301T010000Z5fa30d57-27b3-461f-973e-d46e91f56f86\nDTSTAMP:20230228T230000Z\nDTSTART;TZID=Europe/Berlin:20230303T230000\nDTEND;TZID=Europe/Berlin:20230304T230000\nEND:VEVENT\nBEGIN:VEVENT\nUID:20230502T000000Z5fa30d57-27b3-461f-973e-d46e91f56f86\nDTSTAMP:20230502T000000Z\nDTSTART;TZID=Europe/Berlin:20230505T000000\nDTEND;TZID=Europe/Berlin:20230507T000000\nEND:VEVENT\nEND:VCALENDAR"
  validBefore: null
  validFrom: null
}

Get error - ErrorMessage: "only one grant allowed per lock and user/card".

I tried to request /api/v1/Owners/{ownerAccountId}/Grants/{id} resource to update tapkey grunt.

enter image description here

enter image description here

Community
  • 1
  • 1

1 Answers1

1

The question doesn't provide this information, but I assume that you are using PUT request to change the grant, which is incorrect. PUT requests are used to create new entities and not to update them. For update please use PATCH request.

You are getting result 400 and the error message because every contact-lock combination can have only one access grant and with PUT you are trying to create a new one.

Please have a look here to read more about updating grant: https://developers.tapkey.io/openapi/tapkey_access_management_web_api_v1/#/Grants/Grants_PatchById

I hope this helps!

eduard
  • 408
  • 3
  • 13
  • I used PATCH request. (added screens to question) – Vlad Mashenko May 03 '23 at 07:22
  • Please try to just provide timeRestrictionIcal, validFrom, validBefore parameters and see if it works. No bound lock id or contact id is necessary, as you define the grant id in the request path. – eduard May 04 '23 at 10:28