User Settings Methods
Description of the JSON structure for Oauth application
| Field | Type | Description | 
|---|---|---|
| id | String | Oauth application ID | 
| name | String | Oauth application name | 
| description | String | Oauth application description | 
| clientId | String | Client ID | 
| clientSecret | String | Client secret | 
| homepageUrl | String | Homepage URL | 
| authCallbackUrl | String | Authorization callback URL | 
| standalone | Boolean | Indicates if the application has no server-side component | 
Adding an SSH key
POST /user/settings/add-ssh-key
This request adds an SSH key.
Request
Supported JSON format
POST request body structure:
| Parameter | Type | Description | 
|---|---|---|
| publicKey | String | SSH key | 
| title | String | Title for the SSH key | 
| expiresAt | String | Expiration date in ISO format. Can be left empty to create a key with no time limit | 
Example JSON object
{
    "publicKey" : "ssh-ed25519 AAAAC3NzaC1lZHRNRPTE5AAAAIDkxja/2VmTEsJDTtf3bI4XYDpb58fvKfSjy7/u8EZeI your_email@gitflic.ru",
    "title": "Key title",
    "expiresAt" : "2020-10-10T10:10:10Z"
}
Responses
STATUS 200 example JSON:
Example response
    
{
    uuid:"089cdbe3-aaaa-aaaa-aaaa-b0edde8eda6d"
    publicKey:"ssh-ed25519 AAAAC3NzaC1lZHRNRPTE5AAAAIDkxja/2VmTEsJDTtf3bI4XYDpb58fvKfSjy7/u8EZeI your_email@gitflic.ru"
    title:"Key title"
    expiresAt: "2020-10-10T10-10-10Z"
    userUuid:"f1a94466-aaaa-aaaa-aaaa-744ec3bbd60c"
}
    
  
STATUS 403 - No access rights.
STATUS 404 - Data not found.
STATUS 422 - This key is already in use.
Changing email
PUT /user/change-email
This request changes the user's email.
Request
Supported JSON format
POST request body structure:
| Parameter | Description | 
|---|---|
| email | New user e-mail | 
Example JSON object
{
    "email": "email@local.ru",
}
Responses
STATUS 200 - Email changed successfully.
STATUS 403 - No access rights.
STATUS 422 - User with such data already exists or invalid data entered.
Changing username
PUT /user/change-username
This request changes the user's username.
Request
Supported JSON format
POST request body structure:
| Parameter | Description | 
|---|---|
| username | New user username | 
Example JSON object
{
    "username": "adminuser",
}
Responses
STATUS 200 - Username changed successfully.
STATUS 403 - No access rights.
STATUS 422 - User with such data already exists or invalid data entered.
Changing user password
PUT /user/change-password
This request changes the user's password.
Request
Supported JSON format
POST request body structure:
| Parameter | Description | 
|---|---|
| oldPassword | Old password | 
| password | New user password | 
| passwordConfirm | Password confirmation | 
Example JSON object
{
    "oldPassword" : "qwerty",
    "password": "qwerty123",
    "passwordConfirm" : "qwerty123"
}
Responses
STATUS 200 - Password changed successfully.
STATUS 403 - No access rights.
STATUS 422 - User with such data already exists or invalid data entered.
Getting Oauth applications
GET /user/settings/oauth/
This request returns a list of created Oauth applications.
Responses
STATUS 200 example JSON:
Example response
    
{
    "_embedded": {
        "oauthModelList": [
            {
                "id": "a3df4564-xxxx-xxxx-xxxx-21e997dc7df5",
                "name": "my Oauth",
                "description": "for my requests",
                "clientId": "7440f9e8-xxxx-xxxx-xxxx-7e918e72d250",
                "clientSecret": "7f72e106-xxxx-xxxx-xxxx-657665db788e",
                "homepageUrl": "https://gitflic.ru/settings/oauth/create",
                "authCallbackUrl": "https://gitflic.ru/settings/oauth/create",
                "standalone": false
            }
        ]
    },
    "page": {
        "size": 10,
        "totalElements": 1,
        "totalPages": 1,
        "number": 0
    }
}
    
  
STATUS 404 - Data not found.
STATUS 422 - Invalid request.
Getting Oauth application by id
GET /user/settings/oauth/{id}
This request returns an Oauth application.
| Path variable | Type | Description | 
|---|---|---|
| id | String | Application ID, available in the Oauth application page URL or in responses to other methods | 
Responses
STATUS 200 example JSON:
Example response
    
{
  "id": "7f8933c7-aaaa-aaaa-aaaa-dbc99a7cd104",
  "name": "Name",
  "description": "Description",
  "clientId": "649947ce-aaaa-aaaa-aaaa-b4efb56bf198",
  "clientSecret": "650e54fa-aaaa-aaaa-aaaa-de6665173bf0",
  "homepageUrl": "https://example.com",
  "authCallbackUrl": "https://example.com",
  "standalone": false
}
    
  
STATUS 404 - Data not found.
STATUS 422 - Invalid request.
Creating an Oauth application
POST /user/settings/oauth
This request creates and returns an Oauth application.
Note: You must additionally register the oauth application according to the instructions
Request
Supported JSON format
POST request body structure:
| Parameter | Type | Description | 
|---|---|---|
| name | String | Oauth application name | 
| description | String | Description | 
| homepageUrl | String | Homepage URL | 
| authCallbackUrl | String | Authorization callback URL | 
| standalone | Boolean | Application without server-side | 
Example JSON object
{
    "name" : "Name",
    "description": "Description",
    "homepageUrl" : "https://example.com",
    "authCallbackUrl" : "https://example.com",
    "standalone" : false
}
Responses
STATUS 200 example JSON:
Example response
    
{
  "id": "7f8933c7-aaaa-aaaa-aaaa-dbc99a7cd104",
  "name": "Name",
  "description": "Description",
  "clientId": "649947ce-aaaa-aaaa-aaaa-b4efb56bf198",
  "clientSecret": "650e54fa-aaaa-aaaa-aaaa-de6665173bf0",
  "homepageUrl": "https://example.com",
  "authCallbackUrl": "https://example.com",
  "standalone": false
}
    
  
STATUS 422 - Invalid request.
Editing an Oauth application
PUT /user/settings/oauth/{id}
This request edits and returns an Oauth application.
| Path variable | Type | Description | 
|---|---|---|
| id | String | Application ID, available in the Oauth application page URL or in responses to other methods | 
Request
Supported JSON format
POST request body structure:
| Parameter | Type | Description | 
|---|---|---|
| name | String | Oauth application name | 
| description | String | Description | 
| homepageUrl | String | Homepage URL | 
| authCallbackUrl | String | Authorization callback URL | 
| standalone | Boolean | Application without server-side | 
Example JSON object
{
    "name" : "Name",
    "description": "Description",
    "homepageUrl" : "https://example.com",
    "authCallbackUrl" : "https://example.com",
    "standalone" : false
}
Responses
STATUS 200 example JSON:
Example response
    
{
  "id": "7f8933c7-aaaa-aaaa-aaaa-dbc99a7cd104",
  "name": "Name",
  "description": "Description",
  "clientId": "649947ce-aaaa-aaaa-aaaa-b4efb56bf198",
  "clientSecret": "650e54fa-aaaa-aaaa-aaaa-de6665173bf0",
  "homepageUrl": "https://example.com",
  "authCallbackUrl": "https://example.com",
  "standalone": false
}
    
  
STATUS 404 - Data not found.
STATUS 422 - Invalid request.
Deleting an Oauth application
DELETE /user/settings/oauth/{id}
This request deletes an Oauth application.
| Path variable | Type | Description | 
|---|---|---|
| id | String | Application ID, available in the Oauth application page URL or in responses to other methods | 
Responses
STATUS 200 - Oauth application deleted successfully.
STATUS 404 - Data not found.
Creating an API (access) token
This method requires authentication using Basic Authentication - for the Authorization header, you must provide credentials encrypted with base64 in Basic-auth format.
POST /user/settings/access-token/create
This request creates an access token for working with the API. You can specify a set of permissions and token lifetime.
Request
Supported JSON format
POST request body structure:
| Parameter | Type | Description | 
|---|---|---|
| name | String | Access token name | 
| scopes | Set | Array of token permissions. Possible values: USER_READ,USER_WRITE,PROJECT_READ,PROJECT_WRITE,PROJECT_EDIT,TEAM_READ,TEAM_WRITE,COMPANY_READ,COMPANY_WRITE,READ_REGISTRY, andWRITE_REGISTRY | 
| expiresAt | Date | Date until which the token will be valid | 
Responses
STATUS 200 example JSON:
Example response
    
{
    "token": "240f14e4-aaaa-aaaa-aaaa-c21eaa44ca07",
    "name": "rest-api-token",
    "scopeSet": [
        "USER_READ",
        "USER_WRITE",
        "PROJECT_READ",
        "PROJECT_WRITE"
    ],
    "expiresAt": "2030-01-01T23:59:59"
}
    
  
STATUS 403 - No access rights.
STATUS 422 - Invalid request.
Creating a transport token
POST /user/settings/transport-token/create
This request creates a transport token with the specified permissions and returns it.
Request
Supported JSON format
POST request body structure:
| Parameter | Type | Description | 
|---|---|---|
| name | String | Transport token name | 
| scopes | Set | Array of token permissions. Possible values: WRITE_REGISTRYandREAD_REGISTRY | 
Responses
STATUS 200 example JSON:
Example response
    
{
    "token": "33695ba2-aaaa-aaaa-aaaa-f0167259f115",
    "name": "API key",
    "scopeSet": [
        "WRITE_REGISTRY",
        "READ_REGISTRY"
    ]
}
    
  
STATUS 403 - No access rights.
STATUS 422 - Invalid request.
Automated translation!
This page was translated using automatic translation tools. The text may contain inaccuracies.