Create a user-level variable
POST
/user/actions/variables/{variablename}
const url = 'https://gitea.example.com/api/v1/user/actions/variables/example';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"value":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://gitea.example.com/api/v1/user/actions/variables/example \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "value": "example" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”variablename
required
string
Name of the variable
Request Body
Section titled “Request Body”Media typeapplication/json
CreateVariableOption the option when creating variable
object
value
required
Value of the variable to create
string
Examplegenerated
{ "value": "example"}Responses
Section titled “Responses”Response when creating a variable
Media typeapplication/json
Response when creating a variable
Media typeapplication/json
APIError is error format response
Media typeapplication/json
Headers
Section titled “Headers”message
string
url
string
APINotFound is a not found empty response
Media typeapplication/json