Roles endpoints
This document contains the endpoints for the Roles category.
Gets all the roles
/api/v1/auth/roles
Authorized
This endpoint returns all the roles
Request examples
/v1/auth/roles
Authorized
curl --location 'http://localhost/api/v1/auth/roles '
--header 'Authorization ••••••'
var client = new HttpClient ();
var request = new HttpRequestMessage ( HttpMethod . Get , "http://localhost/api/v1/auth/roles " );
request . Headers . Add ( "Authorization" , "••••••" );
var response = await client . SendAsync ( request );
response . EnsureSuccessStatusCode ();
var responseString = await response . Content . ReadAsStringAsync ();
package main
import (
"fmt"
"net/http"
"strings"
"io"
)
func main () {
url := "http://localhost/api/v1/auth/roles "
method := "get"
client := & http . Client {}
req , err := http . NewRequest ( method , url , payload )
if err != nil {
fmt . Println ( err )
return
}
req . Header . Add ( "Content-Type" , "application/json" )
req . Header . Add ( "Authorization" , "••••••" )
res , err := client . Do ( req )
if err != nil {
fmt . Println ( err )
return
}
defer res . Body . Close ()
body , err := io . ReadAll ( res . Body )
if err != nil {
fmt . Println ( err )
return
}
fmt . Println ( string ( body ))
}
Gets a role
/api/v1/auth/roles/{id}
Authorized
This endpoint returns a role
Parameters
Name
Type
In
Required
Description
id
string
path
required
Role ID
Request examples
/v1/auth/roles/{id}
Authorized
curl --location 'http://localhost/api/v1/auth/roles/{id} '
--header 'Authorization ••••••'
var client = new HttpClient ();
var request = new HttpRequestMessage ( HttpMethod . Get , "http://localhost/api/v1/auth/roles/{id} " );
request . Headers . Add ( "Authorization" , "••••••" );
var response = await client . SendAsync ( request );
response . EnsureSuccessStatusCode ();
var responseString = await response . Content . ReadAsStringAsync ();
package main
import (
"fmt"
"net/http"
"strings"
"io"
)
func main () {
url := "http://localhost/api/v1/auth/roles/{id} "
method := "get"
client := & http . Client {}
req , err := http . NewRequest ( method , url , payload )
if err != nil {
fmt . Println ( err )
return
}
req . Header . Add ( "Content-Type" , "application/json" )
req . Header . Add ( "Authorization" , "••••••" )
res , err := client . Do ( req )
if err != nil {
fmt . Println ( err )
return
}
defer res . Body . Close ()
body , err := io . ReadAll ( res . Body )
if err != nil {
fmt . Println ( err )
return
}
fmt . Println ( string ( body ))
}
Creates a role
/api/v1/auth/roles
Authorized
This endpoint creates a role
Parameters
Name
Type
In
Required
Description
roleRequest
object
body
optional
Role Request
Request examples
/v1/auth/roles
Authorized
curl --location 'http://localhost/api/v1/auth/roles '
--header 'Authorization ••••••'
--header 'Content-Type: application/json'
--data '{ object }'
var client = new HttpClient ();
var request = new HttpRequestMessage ( HttpMethod . Post , "http://localhost/api/v1/auth/roles " );
request . Headers . Add ( "Authorization" , "••••••" );
request . Headers . Add ( "Content-Type" , "application/json" );
request . Content = new StringContent ( "{ object }" );
request . Content = content ;
var response = await client . SendAsync ( request );
response . EnsureSuccessStatusCode ();
var responseString = await response . Content . ReadAsStringAsync ();
package main
import (
"fmt"
"net/http"
"strings"
"io"
)
func main () {
url := "http://localhost/api/v1/auth/roles "
method := "post"
payload := strings . NewReader ( `{ object }` )
client := & http . Client {}
req , err := http . NewRequest ( method , url , payload )
if err != nil {
fmt . Println ( err )
return
}
req . Header . Add ( "Content-Type" , "application/json" )
req . Header . Add ( "Authorization" , "••••••" )
res , err := client . Do ( req )
if err != nil {
fmt . Println ( err )
return
}
defer res . Body . Close ()
body , err := io . ReadAll ( res . Body )
if err != nil {
fmt . Println ( err )
return
}
fmt . Println ( string ( body ))
}
Delete a role
/api/v1/auth/roles/{id}
Authorized
This endpoint deletes a role
Parameters
Name
Type
In
Required
Description
id
string
path
required
Role ID
Request examples
/v1/auth/roles/{id}
Authorized
curl --location 'http://localhost/api/v1/auth/roles/{id} '
--header 'Authorization ••••••'
var client = new HttpClient ();
var request = new HttpRequestMessage ( HttpMethod . Delete , "http://localhost/api/v1/auth/roles/{id} " );
request . Headers . Add ( "Authorization" , "••••••" );
var response = await client . SendAsync ( request );
response . EnsureSuccessStatusCode ();
var responseString = await response . Content . ReadAsStringAsync ();
package main
import (
"fmt"
"net/http"
"strings"
"io"
)
func main () {
url := "http://localhost/api/v1/auth/roles/{id} "
method := "delete"
client := & http . Client {}
req , err := http . NewRequest ( method , url , payload )
if err != nil {
fmt . Println ( err )
return
}
req . Header . Add ( "Content-Type" , "application/json" )
req . Header . Add ( "Authorization" , "••••••" )
res , err := client . Do ( req )
if err != nil {
fmt . Println ( err )
return
}
defer res . Body . Close ()
body , err := io . ReadAll ( res . Body )
if err != nil {
fmt . Println ( err )
return
}
fmt . Println ( string ( body ))
}
Gets all claims for a role
/api/v1/auth/roles/{id}/claims
Authorized
This endpoint returns all claims associated with a role
Parameters
Name
Type
In
Required
Description
id
string
path
required
Role ID
Request examples
/v1/auth/roles/{id}/claims
Authorized
curl --location 'http://localhost/api/v1/auth/roles/{id}/claims '
--header 'Authorization ••••••'
var client = new HttpClient ();
var request = new HttpRequestMessage ( HttpMethod . Get , "http://localhost/api/v1/auth/roles/{id}/claims " );
request . Headers . Add ( "Authorization" , "••••••" );
var response = await client . SendAsync ( request );
response . EnsureSuccessStatusCode ();
var responseString = await response . Content . ReadAsStringAsync ();
package main
import (
"fmt"
"net/http"
"strings"
"io"
)
func main () {
url := "http://localhost/api/v1/auth/roles/{id}/claims "
method := "get"
client := & http . Client {}
req , err := http . NewRequest ( method , url , payload )
if err != nil {
fmt . Println ( err )
return
}
req . Header . Add ( "Content-Type" , "application/json" )
req . Header . Add ( "Authorization" , "••••••" )
res , err := client . Do ( req )
if err != nil {
fmt . Println ( err )
return
}
defer res . Body . Close ()
body , err := io . ReadAll ( res . Body )
if err != nil {
fmt . Println ( err )
return
}
fmt . Println ( string ( body ))
}
Adds a claim to a role
/api/v1/auth/roles/{id}/claims
Authorized
This endpoint adds a claim to a role
Parameters
Name
Type
In
Required
Description
id
string
path
required
Role ID
body
object
body
optional
Claim Name
Request examples
/v1/auth/roles/{id}/claims
Authorized
curl --location 'http://localhost/api/v1/auth/roles/{id}/claims '
--header 'Authorization ••••••'
--header 'Content-Type: application/json'
--data '{ object }'
var client = new HttpClient ();
var request = new HttpRequestMessage ( HttpMethod . Post , "http://localhost/api/v1/auth/roles/{id}/claims " );
request . Headers . Add ( "Authorization" , "••••••" );
request . Headers . Add ( "Content-Type" , "application/json" );
request . Content = new StringContent ( "{ object }" );
request . Content = content ;
var response = await client . SendAsync ( request );
response . EnsureSuccessStatusCode ();
var responseString = await response . Content . ReadAsStringAsync ();
package main
import (
"fmt"
"net/http"
"strings"
"io"
)
func main () {
url := "http://localhost/api/v1/auth/roles/{id}/claims "
method := "post"
payload := strings . NewReader ( `{ object }` )
client := & http . Client {}
req , err := http . NewRequest ( method , url , payload )
if err != nil {
fmt . Println ( err )
return
}
req . Header . Add ( "Content-Type" , "application/json" )
req . Header . Add ( "Authorization" , "••••••" )
res , err := client . Do ( req )
if err != nil {
fmt . Println ( err )
return
}
defer res . Body . Close ()
body , err := io . ReadAll ( res . Body )
if err != nil {
fmt . Println ( err )
return
}
fmt . Println ( string ( body ))
}
Removes a claim from a role
/api/v1/auth/roles/{id}/claims/{claim_id}
Authorized
This endpoint removes a claim from a role
Parameters
Name
Type
In
Required
Description
id
string
path
required
Role ID
claim_id
string
path
required
Claim ID
Request examples
/v1/auth/roles/{id}/claims/{claim_id}
Authorized
curl --location 'http://localhost/api/v1/auth/roles/{id}/claims/{claim_id} '
--header 'Authorization ••••••'
var client = new HttpClient ();
var request = new HttpRequestMessage ( HttpMethod . Delete , "http://localhost/api/v1/auth/roles/{id}/claims/{claim_id} " );
request . Headers . Add ( "Authorization" , "••••••" );
var response = await client . SendAsync ( request );
response . EnsureSuccessStatusCode ();
var responseString = await response . Content . ReadAsStringAsync ();
package main
import (
"fmt"
"net/http"
"strings"
"io"
)
func main () {
url := "http://localhost/api/v1/auth/roles/{id}/claims/{claim_id} "
method := "delete"
client := & http . Client {}
req , err := http . NewRequest ( method , url , payload )
if err != nil {
fmt . Println ( err )
return
}
req . Header . Add ( "Content-Type" , "application/json" )
req . Header . Add ( "Authorization" , "••••••" )
res , err := client . Do ( req )
if err != nil {
fmt . Println ( err )
return
}
defer res . Body . Close ()
body , err := io . ReadAll ( res . Body )
if err != nil {
fmt . Println ( err )
return
}
fmt . Println ( string ( body ))
}