Skip to content

Commit ac5bc50

Browse files
committed
Create API v2
1 parent c9b176d commit ac5bc50

1 file changed

Lines changed: 235 additions & 85 deletions

File tree

src/main/api/studio-api.yaml

Lines changed: 235 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,6 +1924,68 @@ paths:
19241924
'500':
19251925
$ref: '#/components/responses/InternalServerError'
19261926

1927+
/api/2/sites:
1928+
post:
1929+
tags:
1930+
- sites
1931+
summary: Create a site. It can be created from a blueprint or from a remote repository.
1932+
description: 'Required Permission: "create_site"'
1933+
operationId: createSiteFromBlueprint
1934+
requestBody:
1935+
description: The site information
1936+
required: true
1937+
content:
1938+
application/json:
1939+
schema:
1940+
discriminator:
1941+
propertyName: source
1942+
mapping:
1943+
blueprint: '#/components/schemas/CreateSiteFromBlueprintRequest'
1944+
remote: '#/components/schemas/CreateSiteFromRemoteRequest'
1945+
oneOf:
1946+
- $ref: '#/components/schemas/CreateSiteFromBlueprintRequest'
1947+
- $ref: '#/components/schemas/CreateSiteFromRemoteRequest'
1948+
examples:
1949+
createFromBlueprint:
1950+
summary: Create a site from a blueprint
1951+
value:
1952+
siteId: "my-site"
1953+
name: "My Site"
1954+
description: "This is my site"
1955+
source: "blueprint"
1956+
blueprint: "org.craftercms.blueprint.empty"
1957+
createFromRemote:
1958+
summary: Create a site from a remote repository
1959+
value:
1960+
siteId: "my-site"
1961+
name: "My Site"
1962+
description: "This is my site"
1963+
source: "remote"
1964+
repositoryUrl: "http://myrepo.com/repo.git"
1965+
remoteName: "origin"
1966+
remoteBranch: "branch123"
1967+
authentication:
1968+
username: "myuser"
1969+
password: "mypassword"
1970+
responses:
1971+
'201':
1972+
description: Created
1973+
content:
1974+
application/json:
1975+
schema:
1976+
type: object
1977+
properties:
1978+
response:
1979+
$ref: '#/components/schemas/ApiResponse'
1980+
'400':
1981+
$ref: '#/components/responses/BadRequest'
1982+
'409':
1983+
$ref: '#/components/responses/Conflict'
1984+
'401':
1985+
$ref: '#/components/responses/Unauthorized'
1986+
'500':
1987+
$ref: '#/components/responses/InternalServerError'
1988+
19271989
/api/2/sites/create_site_from_marketplace:
19281990
post:
19291991
tags:
@@ -4087,50 +4149,50 @@ paths:
40874149

40884150
/api/2/configuration/content-type/form_controller:
40894151
get:
4090-
tags:
4091-
- configuration
4092-
summary: Get the form controller (if it exists) script of a given content type
4093-
description: 'Required permission "content_read"'
4094-
operationId: getContentTypeFormController
4095-
parameters:
4096-
- name: siteId
4097-
in: query
4098-
description: site ID
4099-
required: true
4100-
schema:
4101-
type: string
4102-
- name: contentTypeId
4103-
in: query
4104-
required: true
4105-
schema:
4106-
type: string
4107-
responses:
4108-
'200':
4109-
description: 'OK'
4110-
content:
4111-
'*/*':
4112-
schema:
4113-
type: string
4114-
format: binary
4115-
description: The content of the form controller file
4116-
headers:
4117-
Content-Type:
4118-
description: The MIME type of the form controller file
4152+
tags:
4153+
- configuration
4154+
summary: Get the form controller (if it exists) script of a given content type
4155+
description: 'Required permission "content_read"'
4156+
operationId: getContentTypeFormController
4157+
parameters:
4158+
- name: siteId
4159+
in: query
4160+
description: site ID
4161+
required: true
41194162
schema:
4120-
type: string
4121-
Content-Length:
4122-
description: The size in bytes of the form controller file
4163+
type: string
4164+
- name: contentTypeId
4165+
in: query
4166+
required: true
41234167
schema:
4124-
type: integer
4125-
format: int64
4126-
'400':
4127-
$ref: '#/components/responses/BadRequest'
4128-
'401':
4129-
$ref: '#/components/responses/Unauthorized'
4130-
'404':
4131-
$ref: '#/components/responses/NotFound'
4132-
'500':
4133-
$ref: '#/components/responses/InternalServerError'
4168+
type: string
4169+
responses:
4170+
'200':
4171+
description: 'OK'
4172+
content:
4173+
'*/*':
4174+
schema:
4175+
type: string
4176+
format: binary
4177+
description: The content of the form controller file
4178+
headers:
4179+
Content-Type:
4180+
description: The MIME type of the form controller file
4181+
schema:
4182+
type: string
4183+
Content-Length:
4184+
description: The size in bytes of the form controller file
4185+
schema:
4186+
type: integer
4187+
format: int64
4188+
'400':
4189+
$ref: '#/components/responses/BadRequest'
4190+
'401':
4191+
$ref: '#/components/responses/Unauthorized'
4192+
'404':
4193+
$ref: '#/components/responses/NotFound'
4194+
'500':
4195+
$ref: '#/components/responses/InternalServerError'
41344196

41354197
/api/2/configuration/content-type/delete:
41364198
post:
@@ -8836,6 +8898,94 @@ components:
88368898
- blueprintId
88378899
- blueprintVersion
88388900

8901+
CreateSiteRequest:
8902+
type: object
8903+
properties:
8904+
source:
8905+
type: string
8906+
description: The source of the site to create. Possible values are blueprint and remote
8907+
enum:
8908+
- blueprint
8909+
- remote
8910+
siteId:
8911+
type: string
8912+
description: Site ID to use
8913+
name:
8914+
type: string
8915+
description: Site name
8916+
description:
8917+
type: string
8918+
description: Site description
8919+
sandboxBranch:
8920+
type: string
8921+
description: Name for sandbox branch (default master)
8922+
required:
8923+
- siteId
8924+
- name
8925+
- source
8926+
8927+
CreateSiteFromBlueprintRequest:
8928+
allOf:
8929+
- $ref: '#/components/schemas/CreateSiteRequest'
8930+
- type: object
8931+
properties:
8932+
blueprint:
8933+
type: string
8934+
description: The ID of the blueprint to use
8935+
required:
8936+
- blueprint
8937+
8938+
CreateSiteFromRemoteRequest:
8939+
allOf:
8940+
- $ref: '#/components/schemas/CreateSiteRequest'
8941+
- type: object
8942+
properties:
8943+
remoteUrl:
8944+
type: string
8945+
description: URL of the remote repository
8946+
remoteName:
8947+
type: string
8948+
description: Name of the remote repository (default origin)
8949+
remoteBranch:
8950+
type: string
8951+
description: Name of the branch to use from the remote repository (default master)
8952+
authentication:
8953+
$ref: '#/components/schemas/CreateSiteRemoteAuth'
8954+
required:
8955+
- url
8956+
8957+
CreateSiteRemoteAuth:
8958+
oneOf:
8959+
- type: object
8960+
properties:
8961+
username:
8962+
type: string
8963+
description: Username for basic authentication
8964+
password:
8965+
type: string
8966+
description: Password for basic authentication
8967+
required:
8968+
- username
8969+
- password
8970+
- type: object
8971+
properties:
8972+
username:
8973+
type: string
8974+
description: Username for basic authentication
8975+
token:
8976+
type: string
8977+
description: authentication token
8978+
required:
8979+
- username
8980+
- token
8981+
- type: object
8982+
properties:
8983+
privateKey:
8984+
type: string
8985+
description: Private key
8986+
required:
8987+
- privateKey
8988+
88398989
PluginRecord:
88408990
type: object
88418991
properties:
@@ -9292,49 +9442,49 @@ components:
92929442
lastCleanup: null
92939443

92949444
RemoteRepository:
9295-
type: object
9296-
properties:
9297-
siteId:
9298-
type: string
9299-
description: site identifier
9300-
remoteName:
9301-
type: string
9302-
description: remote repository name
9303-
remoteUrl:
9304-
type: string
9305-
format: URL
9306-
description: URL to access remote repository
9307-
authenticationType:
9308-
type: string
9309-
description: >-
9310-
Authentication type to use to access remote repository
9311-
9312-
Possible values:
9313-
9314-
- none: no authentication
9315-
9316-
- basic: username and password authentication
9317-
9318-
- token: token authentication
9319-
9320-
- key: key-based authentication
9321-
remoteUsername:
9322-
type: string
9323-
description: username to use to access remote repository
9324-
remotePassword:
9325-
type: string
9326-
description: password to use to access remote repository
9327-
remoteToken:
9328-
type: string
9329-
description: token to use to access remote repository
9330-
remotePrivateKey:
9331-
type: string
9332-
description: private key to access
9333-
required:
9334-
- siteId
9335-
- remoteName
9336-
- remoteUrl
9337-
- authenticationType
9445+
type: object
9446+
properties:
9447+
siteId:
9448+
type: string
9449+
description: site identifier
9450+
remoteName:
9451+
type: string
9452+
description: remote repository name
9453+
remoteUrl:
9454+
type: string
9455+
format: URL
9456+
description: URL to access remote repository
9457+
authenticationType:
9458+
type: string
9459+
description: >-
9460+
Authentication type to use to access remote repository
9461+
9462+
Possible values:
9463+
9464+
- none: no authentication
9465+
9466+
- basic: username and password authentication
9467+
9468+
- token: token authentication
9469+
9470+
- key: key-based authentication
9471+
remoteUsername:
9472+
type: string
9473+
description: username to use to access remote repository
9474+
remotePassword:
9475+
type: string
9476+
description: password to use to access remote repository
9477+
remoteToken:
9478+
type: string
9479+
description: token to use to access remote repository
9480+
remotePrivateKey:
9481+
type: string
9482+
description: private key to access
9483+
required:
9484+
- siteId
9485+
- remoteName
9486+
- remoteUrl
9487+
- authenticationType
93389488

93399489
RemoteRepositoryInfo:
93409490
type: object

0 commit comments

Comments
 (0)