Examples of how to use type 2 with your application
Example 1:
CREATING USERS
Say suppose you have your own website which solves certain problems of your user, the website might look something like this
And using this website you can add different users to it who could access the website
Now when you add the user, you might have a database in the cloud which might be looking something like this
Locations table
id | name |
1 | Mumbai |
2 | Dubai |
3 | New York |
Roles table
id | name |
1 | Admin |
2 | EndUser |
Users table
id | name | roleId | locationId | |
1 | JaneDoe | janedoe@example.com | 1 | 1 |
2 | johnDoe | johndoe@example.com | 2 | 2 |
Now if you want the users who are there in your system to use spintly application also, you could go with the following two approach
- Manullay add users in your website and spintly website
- Use Spintly CRUD apis to add users in spintly
1st approach would have made sense if you had one users, imaging daily you have to use add 1000 users, the first method is ineffective
Thats why the website needs use spintly apis to create users in spintly, without the admin going to the spintly dashboard,
Below are the changes which you will have to do in your backend
Locations table
id | name | spintlySiteId |
1 | Mumbai | 1001 |
2 | Dubai | 1002 |
3 | New York | 1003 |
Roles table
id | name | spintlyRoleId |
Admin | 1 | 20 |
EndUser | 2 | 21 |
Users table
id | name | roleId | locationId | spintlyOrgUserId | |
So now whenever a user is added from the website as show below
You will first have to create the user in your backend first
Users Table
id | name | roleId | locationId | spintlyOrgUserId | |
1 | john doe | johndoe@example.com | 1 | 3 | |
Once the user is created in your backend, you will have to call spintly Create user api mention in the , the one which is marked in green is the information which is collected from you backend and sent to spintly
Once the user is created in Spintly, it will return a orguserId, which you need to map it to your user in users table as shown below
Users table
id | name | roleId | locationId | spintlyOrgUserId | |
1 | john doe | johndoe@example.com | 1 | 3 | 650126 |
the same user you can see in spintly website also
You can then download the spintly smart access app
DELETING USERS
Deleting users in spintly is almost similar to how you created the user, say you want to delete the user john doe as show below
When you get a delete request make sure you first delete the user in spintly, and then delete the user in you backend, when deleting user in spintly you will have to use the spintly orguserid which you got while creating the user
Users table
id | name | roleId | locationId | spintlyOrgUserId | |
1 | john doe | johndoe@example.com | 1 | 3 | 650126 |
Below is the api how it will look, once you delete, spintly will return a success and once you get success you can delete the user from your backend
Users table
id | name | roleId | locationId | spintlyOrgUserId | |