Skip to content

Commit fe56ca3

Browse files
committed
Create API v2
1 parent c9b176d commit fe56ca3

1 file changed

Lines changed: 240 additions & 85 deletions

File tree

src/main/api/studio-api.yaml

Lines changed: 240 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: sourceType
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+
sourceType: "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+
sourceType: "remote"
1964+
remoteUrl: "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,99 @@ components:
88368898
- blueprintId
88378899
- blueprintVersion
88388900

8901+
CreateSiteRequest:
8902+
type: object
8903+
properties:
8904+
sourceType:
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+
siteParams:
8923+
type: object
8924+
description: Object containing all parameters for the blueprint. It should include all required parameters from the descriptor
8925+
additionalProperties:
8926+
type: string
8927+
required:
8928+
- siteId
8929+
- name
8930+
- sourceType
8931+
8932+
CreateSiteFromBlueprintRequest:
8933+
allOf:
8934+
- $ref: '#/components/schemas/CreateSiteRequest'
8935+
- type: object
8936+
properties:
8937+
blueprint:
8938+
type: string
8939+
description: The ID of the blueprint to use
8940+
required:
8941+
- blueprint
8942+
8943+
CreateSiteFromRemoteRequest:
8944+
allOf:
8945+
- $ref: '#/components/schemas/CreateSiteRequest'
8946+
- type: object
8947+
properties:
8948+
remoteUrl:
8949+
type: string
8950+
description: URL of the remote repository
8951+
remoteName:
8952+
type: string
8953+
description: Name of the remote repository (default origin)
8954+
remoteBranch:
8955+
type: string
8956+
description: Name of the branch to use from the remote repository (default master)
8957+
authentication:
8958+
$ref: '#/components/schemas/CreateSiteRemoteAuth'
8959+
required:
8960+
- url
8961+
8962+
CreateSiteRemoteAuth:
8963+
oneOf:
8964+
- type: object
8965+
properties:
8966+
username:
8967+
type: string
8968+
description: Username for basic authentication
8969+
password:
8970+
type: string
8971+
description: Password for basic authentication
8972+
required:
8973+
- username
8974+
- password
8975+
- type: object
8976+
properties:
8977+
username:
8978+
type: string
8979+
description: Username for basic authentication
8980+
token:
8981+
type: string
8982+
description: authentication token
8983+
required:
8984+
- username
8985+
- token
8986+
- type: object
8987+
properties:
8988+
privateKey:
8989+
type: string
8990+
description: Private key
8991+
required:
8992+
- privateKey
8993+
88398994
PluginRecord:
88408995
type: object
88418996
properties:
@@ -9292,49 +9447,49 @@ components:
92929447
lastCleanup: null
92939448

92949449
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
9450+
type: object
9451+
properties:
9452+
siteId:
9453+
type: string
9454+
description: site identifier
9455+
remoteName:
9456+
type: string
9457+
description: remote repository name
9458+
remoteUrl:
9459+
type: string
9460+
format: URL
9461+
description: URL to access remote repository
9462+
authenticationType:
9463+
type: string
9464+
description: >-
9465+
Authentication type to use to access remote repository
9466+
9467+
Possible values:
9468+
9469+
- none: no authentication
9470+
9471+
- basic: username and password authentication
9472+
9473+
- token: token authentication
9474+
9475+
- key: key-based authentication
9476+
remoteUsername:
9477+
type: string
9478+
description: username to use to access remote repository
9479+
remotePassword:
9480+
type: string
9481+
description: password to use to access remote repository
9482+
remoteToken:
9483+
type: string
9484+
description: token to use to access remote repository
9485+
remotePrivateKey:
9486+
type: string
9487+
description: private key to access
9488+
required:
9489+
- siteId
9490+
- remoteName
9491+
- remoteUrl
9492+
- authenticationType
93389493

93399494
RemoteRepositoryInfo:
93409495
type: object

0 commit comments

Comments
 (0)