I'm using eclipse che on kubernetes using docker desktop for windows
I want to create or stop(or delete) workspace through HTTP REST API
Is there REST API provided from eclipse che?
I searched on the internet, but the most of them are not found since they been shown “404 error page” and some seems to be deprecated(For example, swagger.. )
Is there REST API provided from eclipse che latest version?
I have using eclipse che latest version
@leehyeongrak
Try this
curl 'https://che-che.apps-crc.testing/api/workspace/devfile?attribute=stackName:NodeJS+Angular+Web+Application&infrastructure-namespace=skabashn-che&namespace=skabashn' -H 'Authorization: Bearer ${KEYCLOAK_TOKEN}' --data-binary '{"apiVersion":"1.0.0","metadata":{"generateName":"angular-","name":"wksp-uu57"},"projects":[{"name":"angular-realworld-example-app","source":{"type":"git","location":"https://github.com/gothinkster/angular-realworld-example-app"}}],"components":[{"type":"chePlugin","id":"che-incubator/typescript/latest"},{"type":"dockerimage","alias":"nodejs","image":"quay.io/eclipse/che-nodejs10-community:nightly","memoryLimit":"1Gi","endpoints":[{"name":"angular","port":4200}],"mountSources":true}],"commands":[{"name":"yarn install","actions":[{"type":"exec","component":"nodejs","command":"yarn install","workdir":"${CHE_PROJECTS_ROOT}/angular-realworld-example-app"}]},{"name":"build","actions":[{"type":"exec","component":"nodejs","command":"yarn run build","workdir":"${CHE_PROJECTS_ROOT}/angular-realworld-example-app"}]},{"name":"start","actions":[{"type":"exec","component":"nodejs","command":"yarn run start --host 0.0.0.0 --disableHostCheck true","workdir":"${CHE_PROJECTS_ROOT}/angular-realworld-example-app"}]},{"name":"lint","actions":[{"type":"exec","component":"nodejs","command":"yarn run lint","workdir":"${CHE_PROJECTS_ROOT}/angular-realworld-example-app"}]}]}'
curl 'https://che-che.apps-crc.testing/api/workspace/${workspaceID}/runtime' -X POST -H 'Authorization: Bearer ${KEYCLOAK_TOKEN}'
Also, you might want to consider to use factories https://www.eclipse.org/che/docs/che-7/configuring-a-workspace-using-a-devfile/#creating-a-workspace-from-the-default-branch-of-a-git-repository_configuring-a-workspace-using-a-devfile
It is a much easier way to embed Eclipse Che functionality to your site.
@skabashnyuk we do not generate openapi shema / swagger URL anymore?
@skabashnyuk
Thanks for the answer!
I have another question about it
Is there a way to create workspace from a private git repository when creating a workspace using the REST API?
I sent a request with private git repository URL as above but git clone failed..
Is there a safe way to create a workspace with private git project using a personal access token or something else?
Thank you for your help.
@leehyeongrak in theory it should be possible with ssh keys.
@ibuziuk we do generate swagger.