Actions

Description

Actions allow you to specify actions to take next time the specified project is loaded. There are two types of actions: file actions and exec actions. File actions can be used to create and update project files, while exec actions can be used to run a command when the sandbox is loaded.

put
Actions

https://api.next.tech/v1/projects/{project_uid}/actions
Request
Response
Path Parameters
project_uid
required
string
The UID of the project to execute the actions for Example: 69aceb37-dda0-4905-8217-afbdd9003dc3
Body Parameters
actions
required
array
An array of actions (detailed below)
200: OK
[
{
"action": "file:create",
"contents": "SGVsbG8sIFdvcmxkIQ==",
"filename": "/home/nt-user/workspace/hello_world.txt",
"open": true
},
{
"action": "exec",
"cmd": ["mkdir", "tmp"],
"cwd": "/home/nt-user",
"stdin": ""
}
]

Supported Actions

The following actions are supported.

File Actions

Parameters

Action: file:create or file:update.

Key

Type

Required

Description

filename

string

yes

Name of file

contents

string

yes

Base64 string of file contents

open

boolean

no

If file should be opened by default when project loads (only supported for files in /home/nt-user/workspace)

repeat

boolean

no

If the action should continue to be replayed against all new sandboxes until overwritten (defaults to false)

Example Request Body

{
"actions": [
{
"action": "file:create",
"contents": "SGVsbG8sIFdvcmxkIQ==",
"filename": "/home/nt-user/workspace/hello_world.txt"
}
]
}

Exec Actions

Action: exec.

Parameters

Key

Type

Required

Description

cmd

array

yes

The command to execute, specified as an array of strings with the command as the first element and the args as the following elements

stdin

string

no

Base64 string of input to provide to cmd

cwd

string

no

The directory to execute the command from (defaults to /home/nt-user/workspace)

repeat

boolean

no

If the action should continue to be replayed against all new sandboxes until overwritten (defaults to false)

Example Request Body

{
"actions": [
{
"action": "exec",
"cmd": ["mkdir", "tmp"],
"cwd": "/home/nt-user"
}
]
}