Embed Studio Home Page
Studio can be embedded via iFrame just like code editor.
<iframe
frameBorder="0"
height="700px"
width="100%"
src="https://onecompiler.com/embed/studio"
></iframe>
Embed Template Home Page
To embed a template launch page use the below URL.
Note: use the template id in the URL like python in the below example.
<iframe
frameBorder="0"
height="700px"
width="100%"
src="https://onecompiler.com/embed/studio/python"
></iframe>
Embed Workspace Page
To embed a workspace page use the below URL.
<iframe
frameBorder="0"
height="700px"
width="100%"
src="https://onecompiler.com/embed/studio/python/42964snje"
></iframe>
More options via query parameters
Query Parameter | Description | Required? |
---|---|---|
apiKey | Your API account key (not the accessToken) | Required |
userApiToken | Token you get when sync your application users | Required |
theme=dark | Load Studio in Dark Theme | Optional |
hideWorkspaces=true | Hide workspaces list, Only applicable in Embed Template Home Page | Optional |
externalId | External Id from 3rd party application. Shown in /api/v1/studio/workspaces API | Optional |
properties.<key> | Custom properties to be passed to the Studio. ex. properties.foo=bar | Optional |
Please check the Enterprise APIs section for more advanced options like syncing user data and obtaining userApiToken.
Read Studio workspaces data programmatically
You can read a user's workspaces data using the below API.
curl --location 'https://onecompiler.com/api/v1/studio/workspaces' \
--header 'Content-Type: application/json' \
--data '{
"apiKey": "your_company_account_key",
"userApiToken": "user_api_token"
}'
Sample Response
{
"status": "success",
"workspaces": [
{
"_id": "42964snje",
"externalId": "74528374",
"properties" : {
"foo": "bar",
"baz": "qux"
},
"created": "2024-03-20T02:56:05.838Z",
"template": {
"_id": "python"
},
"status": "stopped",
"usageTotal": 24,
"backup" : "https://studio.datashortener.com/workspaces/abc/xyz.zip",
"url": "https://onecompiler.com/studio/python/42964snje"
},
{
"_id": "42964t2ex",
"externalId": null,
"created": "2024-04-01T02:56:10.840Z",
"template": {
"_id": "react"
},
"status": "stopped",
"usageTotal": 0,
"backup" : "https://studio.datashortener.com/workspaces/abc/xyz.zip",
"url": "https://onecompiler.com/studio/react/42964t2ex"
}
]
}