Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Overview
  • FAQs
  • Software Guides
  • Hardware Guide
  • Integration
  • Technical Blogs

Categories

  • Overview
  • FAQs
  • Software Guides
  • Hardware Guide
  • Integration
  • Technical Blogs
Home / Integration / Spintly Platform Integrations

Examples of how to use type 3 with your application

Categories

Overview FAQs Software Guides Hardware Guide Integration Technical Blogs

Examples of how to use type 3 with your application

Before you go through this article make sure you have familiarize yourself with the spintly type 3 apis, if you have not please visit the following two links

  1. In depth explanation of all the apis spintly provides with type3 - click here to visit the page
  2. Steps to get up and running with type3 integration  - click here to visit the page
     

Example 1:

Say you are an existing access control company which already have your own access control software, you might be integrated with other access control hardware etc, now you want to integrate with spintly. Your website looks like something below

 

 

Below is the small functionality of the website

 

As you can in the above website you have two sections 

  1. User Management
      a) Adding user along with granting door permission
      b) View  Door Permissions 
      c) Deleting Users
     
  2. Door Management
      a) View users assigned to a door
      b) Assign users to a door

Below are the tables which might be present in your backend to show the above data

Company table

id name
1 Acme
2 SpaceY
3 elloit

Locations table

id name
1 Mumbai
2 Dubai
3 New York

Roles table

id name
1 Admin
2 EndUser

Users table

id companyid uniqueid name email roleId locationId
1 1 #rwe3333 JaneDoe janedoe@example.com 1 1
2 2 #rrwer222 johnDoe johndoe@example.com 2 2

 

Doors table

id name
1 Door 1
2 Door 2
3 Door 3
4 Door 4

 

 

So if you website has similar functionalities, below steps will show what apis and changes you will need to do to integrate with spintly

The tables will look like this

Company table

id name spintlyOrgId
1 Acme 11
2 SpaceY 222
3 elloit 333

Locations table

id name spintlySiteId
1 Mumbai 1001
2 Dubai 1002
3 New York 1003

SpintlyBackendDetails table

spintlyBackendClientid spintlyBackendClientSecret spintlyAccessToken spintlyrefreshToken
a21a2cca-1220-4619-93f1-e26708dde8f0 0c444884-c697-4d36-9dc4-81a97c53d56c    

 

SpintlyMobileDetails

spitnlySDKproviderId spintlySDKCLientId
6b848c17-56df-418d-8a0f-42a6c0508b7f 188803c4-c3dd-4a45-a32b-2f31861c45cd

 

 

Users table

id companyid uniqueid name email roleId locationId spintlyAccessorid
               
               

 

Doors table
(Here SpintlyAccessPointId can be populated by providing spintly a webhook, whenever a new door is added, the same door details can be forwarded to yourbackend and you map it to your door)

id name spintlyAccessPointId
1 Door 1 23
2 Door 2 34
3 Door 3 44
4 Door 4 45

 

Adding user along with granting door permission

 

Here when the user is getting created he will be mentioning his user info along with door permissions, here in the above image, alan simth details are added, also what door permissions alan smith needs to be given ir door2 and door3 are also specified. So when this requests hits client backend, the user first will be created

Users table

id companyid uniqueid name email roleId locationId spintlyAccessorid
1 1 #rwe3333 John Doe john.doe@example.com 1 1 123
2 2 #rrwer222 Jane Smith jane.smith@example.com 2 2 133
3 1 #fdfdfffff Alan Smith alan.smith@exmple.com 1 1  

 

Before you call Spintly Create accessor api you will first have to get a acess token using the spintlyclientid and spintlyclientSecret mentioned in the  SpintlyBackendDetails table, the api will return an access token and refresh token

 

 

the access token, refresh token which the api returns needs to saved in the SpintlyBackendDetails table

 

SpintlyBackendDetails table

spintlyBackendClientid spintlyBackendClientSecret spintlyAccessToken spintlyrefreshToken
a21a2cca-1220-4619-93f1-e26708dde8f0 0c444884-c697-4d36-9dc4-81a97c53d56c eyJhbGciOiJSUzI eGPTxWd5H

 

Now using spintlyAccessToken you can call the create accessor api

 

Explantation: Here orgid you can get from companies table,credentialid to be put if card is assigned, if not please keep it null

permissionsToAdd will contain permission the user needs to get, in the image the user is given permissions to Door 2 and Door 3 which has 34 and 44 access point id mapped in the Doors table, so you will put an array of permissions ie 34 and 44 

In the identityInfo object, for provider put spitnlySDKproviderId from the SpintlyMobileDetails table and for sub please put uniqueid value from users table. once you call the api you will get a accessorId, which you will have to put for the value of spintlyAccessorid in Users table

 

id companyid uniqueid name email roleId locationId spintlyAccessorid
1 1 #rwe3333 John Doe john.doe@example.com 1 1 123
2 2 #rrwer222 Jane Smith jane.smith@example.com 2 2 133
3 1 #fdfdfffff Alan Smith alan.smith@exmple.com 1 1 14257

Once the user is created in the table you can call spintly create accessor api, while calling spintly api, you will have to spintlyorgid(this you can get from company table above), the spintly access point ids(this  you can get from doors table above) and the sub(this you can give  the value uniquqId field from users table)

View  Door Permissions

 

If you want to show the door permissions your front will have to call your backend api passing the userid,companyid, once the backend api gets the userid, it will take the associated accessorId mapped and call spintly get permission apis as mentioned below, using the companyId you can get the organisationId. using both these values you can call the get permissions of an accessor apis

Note: the token process will be the same as shown when creating a user

 

 

Once you get the response, you can convert the accessorid back to userid and the accesspointid in the response should be converted to doorids and return the response to the ui

 

Alternatively. You can maintain a table of which user has which permissions and periodically sync it up with spintly as shown as below

Permissions table

id userId doorId
1 3 34

 

Deleting Users

When a deleting user, the website will be passing userid via api to the backend

 

 

using the userid, the accessorid can be got and using the accessorid, you can call the delete accessor api

Note spintly also provides an another api to delete accessor from an organisations, incase if accessor is part of multiple organisaitons

 

id companyid uniqueid name email roleId locationId spintlyAccessorid
1 1 #rwe3333 John Doe john.doe@example.com 1 1 123
2 2 #rrwer222 Jane Smith jane.smith@example.com 2 2 133
               

 

View users assigned to a door

Below if you click on view users assigned, it shows all the users assigned to the door

 

 

Similar like previous apis, the frontend will send backend the doorId, using the doorId we will get the spintlyAccessPointId, using the spintly access point id, we can call spintly get permissions api

 

 

 

 

As you can see in the response it returns an arrray of permissions of each accessor for that accesspointid, this accessorid can be converted to userid and the permissions can be shown to the ui

Assign users to a door

On click of Assign users, you can assign more users to a door

As like before the front end will be sending the backend the userids of the users to who the permissions needs to be assigned, the companyId and doorid also will be sent , the userids can be converted to accessorids, the companyid will be converted to organisaitonId and doorId will be converted to access point id and spintly assign users to acess point api can be called 

 

implementation type 3

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Steps to get up and running (Type 3 integration)
  • Spintly Integration Overview
  • Type 3 integration
  • Prerequisite for backend api Integration
Spintly

Industries

  • Multifamily / Residential
  • Co-Working
  • Education
  • Healthcare
  • Hospitality
  • Manufacturing
  • Fitness & Wellness

Solutions

  • Access Control
  • Visitor Management
  • Tenant Management
  • Time & Attendance Management

About

  • About Us
  • Partners
  • FAQ
  • Privacy Policy
  • Terms & Conditions

Resources

  • Case Studies
  • Blogs
  • Whitepapers
  • Webinars
  • Press
  • Data Sheets

Contact Us

  • Sales: sales@spintly.com
  • Tech Support: support@spintly.com
  • Get a Quote
© 2024 Spintly. All Rights Reserved. | 691 S Milpitas Blvd, Ste 217 Milpitas, CA 95035
Expand