Create a new rank including an icon in Aurora.
You can create any rank you want for your community members. For example, if your community is based out of the music field, you can create the following ranks in your community:
- Amateur Musician
- Advanced Amateur Musician
- Intermediate Musician
- Advanced Intermediate Musician
- Professional Musician
- Advanced Professional Musician
The created ranks are listed in Admin > Settings > Users > Ranks based on the rank level.
Requirements
You must have the Ranks option turned on in Admin > Settings > Users > Ranks.
Note: Aurora Community provides a list of default ranks. You can also create your community-specific ranks.
Example Request
In this example, we will create a rank called Example Rank
.
Creating a rank with an included icon file requires a POST request to /api/2.1/graphql with a form-data body type.
In the GraphQL POST request, we have added three parameters:
Form-data Parameter | Description |
---|---|
operations | This parameter has the mutation query in a form-data. Using this parameter, we pass the query parameters to create the rank with the above-specified parameter. |
variables | This parameter maps the input query with the attachment file. |
0 | This parameter adds your image from your machine to the query. |
The operations form field includes the mutation that creates the rank itself, indicating that the file (referenced as $file
) will be used as the new icon.
mutation ($file: Upload!) {
createRank(
createInput: {
name: "<RANK-NAME>"
icon: { file: $file }
position: 200
color: "<RANK-COLOR>"
rankStyle: FILLED
formula: "(logins >2)"
}
) {
result {
icon {
url
}
}
}
}
The createInput
object contains all of the information Aurora needs to generate a new rank. Fields in the object include:
Name | Description |
---|---|
name | Here, we entered the name we want to use for the new rank. |
icon | This field indicates that a file included in the request will serve as the icon for the new rank. We support the PNG file type. |
position | The position of the rank in the hierarchy. The value 1 indicates the highest rank. |
color | The color used to display the rank's label. |
formula | This is where we entered the formula to determine when a user earned the rank. In this case, logins >2 means the user has logged in more than twice. |
In a separate form-data field, point to the file you wish to upload to serve as the rank as the value of a separate 0
form-data key. This file will be uploaded as part of the request.
Example Response
{
"data": {
"createRank": {
"result": {
"id": "rank:53",
"name": "rank_1",
"icon": {
"url": "http://example.com/lia/images/cmstNTMtOTFSU281"
}
}
}
}
}
ATLAS
Comments