Setting up and Managing Roles
If gates are created to provide access control to a project, roles are created to define the level of access the token holder has as they transverse the application.
Roles are created with a POST request to the /Gates/{id}/roles endpoint, more roles can be added to a gates role list with a PATCH request to the /Gates/{id}/roles endpoint and deleting a role can be done with the . Let's look at how to create a role
Creating a Role
Creating role takes in a number of values as its request body. These values help the API define the type of Token that should be expected, the required number of tokens that should be expected et.al. Let's see what a sample request body would look like
name | name of the role. a string. |
matchType | defines what token class the role is to be matched to. this is an enum of a type default , NFT , and SFT |
priority | a developer-defined value that helps provide higher access rights to the application based on the number used as the value. for example, a value of 5 will have more access than a value of 0 . |
requiredQuantity | number of tokens that must be held to enjoy the role |
chainId | the id of the chain the contract is to be deployed on |
contractAddress | the contract address |
tokenId | the token id |
A 200
response body will look like this
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"gateId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "string",
"chainId": "string",
"contractAddress": "string",
"matchType": "Default",
"tokenId": 0,
"requiredQuantity": 0,
"priority": 0
}
]
a 400
response body will look like this
{
"type": "string",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string",
"errors": {
"additionalProp1": [
"string"
],
"additionalProp2": [
"string"
],
"additionalProp3": [
"string"
]
},
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
}
Updated 5 months ago