# Accessing AIQ Repository Configuration via REST APIs

This is a list of useful repository related REST APIs,

## getRepositoryNamesByUser

### Endpoint

rest/preferences/getRepositoryNamesByUser

### Description

Returns an array with all repository configuration names from current logged in user.

### Request parameters | payload

N/A

### Response

`<span class="editor-theme-code">[ "repoName1", "repoName2", "repoName3" ]</span>`  
or empty array if no repo configs exists.  
  
`<span class="editor-theme-code">[ ]</span>`

## getRepositoryByUser

### Endpoint

`<span class="editor-theme-code">rest/preferences/getRepositoryByUser</span>`

### Description

Returns JSON object with details of the a repo given its name or empty JSON if no configuration with provided name is found.

### Request parameters | payload

`<span class="editor-theme-code">?name=repoName1</span>`

### Response

Success

```
{     "proxyPort": 0,     "commitMessage": "Appvance Commit",     "auth": "Password",     "proxyServer": "",     "proxyUsername": "",     "name": "repoName1",     "proxyPassword": "",     "proxyType": "defatult",     "type": "GIT",     "branch": "main",     "url": "https://gitlab.com/appvnc/repomemo/",     "username": "appvnc"}
```

Error (repoName1 was not found)

```
{ }
```

## getRepositoryStatus

### Endpoint

`<span class="editor-theme-code">rest/preferences/getRepositoryStatus</span>`

### Description

Returns JSON object with status of the a repo given its name.

### Request parameters | payload

`<span class="editor-theme-code">?name=repoName1</span>`

### Response

Success:

```
{     "timeStamp": "2023/01/30 19:59:52",     "stack": "",     "status": "WORKING"}
```

Error:

```
{     "timeStamp": "0",     "stack": "Repository not found",     "status": "ERROR"}
```

## pullRepository

### Endpoint

`<span class="editor-theme-code">rest/preferences/pullRepository</span>`

### Description

If repo is found, it triggers a git pull action on the repo and then executes a getRepositoryStatus returning the same JSON as that call.

### Request parameters | payload

`<span class="editor-theme-code">?name=repoName1</span>`

### Response

Success:

```
{     "timeStamp": "2023/01/30 19:59:52",     "stack": "",     "status": "WORKING"}
```

On error:

{

```
{     "timeStamp": "2023/01/30 19:59:52",     "stack": "Repository not found",     "status": "ERROR"}
```

## getBranches

### Endpoint

`<span class="editor-theme-code">rest/preferences/getBranches</span>`

### Description

Returns the names of all the existing branches in the remote repository

### Request parameters | payload

`<span class="editor-theme-code">?name=repoName1</span>`

### Response

Success:

```
{     "timeStamp": "0",     "stack": "",     "branches": [     "main",     "performanceFolder"     ],     "status": "OK"}
```

On Error:

```
{     "timeStamp": "0",     "stack": "Repository not found",     "status": "ERROR"}
```

## saveRepository

### Endpoint

`<span class="editor-theme-code">rest/preferences/saveRepository</span>`

### Description

Saves new or updates repository configuration

Possible error messages:  
"Repository with given name exists"  
"Incorrect credentials."

### Request parameters | payload

```
{"type":"GIT","name":"repoName1","url":"https://gitlab.net/ac/repo.git","username":"user@example.com","ssh":"","auth":"Password","password":"Wkdz!vxh14x9","branch":"","commitMessage":"","proxyServer":"","proxyPort":0,"proxyUsername":"","proxyPassword":"","proxyType":"defatult"}
```

### Response

Success:

```
{     "message": "Repository successfully saved.",     "status": "success"}
```

On Error:

```
{     "message": "Error: check your repository configuration.",     "status": "error"}
```

## deleteRepository

### Endpoint

`<span class="editor-theme-code">rest/preferences/deleteRepository</span>`

### Description

Deletes a repository configuration named repoName1 for current user.

### Request parameters | payload

`<span class="editor-theme-code">?repositoryName=repoName1</span>`

### Response

Success:

`<span class="editor-theme-code">done true</span>`

On Error:

`<span class="editor-theme-code">done false</span>`

---

Last updated: October 16, 2026