cURL
curl --request POST \
--url https://api.camposcloud.com/v1/apps/{appId}/files/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"path": "src",
"name": "config.json",
"isDirectory": false,
"content": "{ \"debug\": false }"
}
'import requests
url = "https://api.camposcloud.com/v1/apps/{appId}/files/create"
payload = {
"path": "src",
"name": "config.json",
"isDirectory": False,
"content": "{ \"debug\": false }"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
path: 'src',
name: 'config.json',
isDirectory: false,
content: '{ "debug": false }'
})
};
fetch('https://api.camposcloud.com/v1/apps/{appId}/files/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.camposcloud.com/v1/apps/{appId}/files/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'path' => 'src',
'name' => 'config.json',
'isDirectory' => false,
'content' => '{ "debug": false }'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.camposcloud.com/v1/apps/{appId}/files/create"
payload := strings.NewReader("{\n \"path\": \"src\",\n \"name\": \"config.json\",\n \"isDirectory\": false,\n \"content\": \"{ \\\"debug\\\": false }\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.camposcloud.com/v1/apps/{appId}/files/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"path\": \"src\",\n \"name\": \"config.json\",\n \"isDirectory\": false,\n \"content\": \"{ \\\"debug\\\": false }\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.camposcloud.com/v1/apps/{appId}/files/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"path\": \"src\",\n \"name\": \"config.json\",\n \"isDirectory\": false,\n \"content\": \"{ \\\"debug\\\": false }\"\n}"
response = http.request(request)
puts response.read_body{
"message": "File created successfully"
}{
"error": "'content' must be a string when 'isDirectory' is false."
}{
"error": "Invalid developer token"
}{
"error": "You do not have permission to perform this action on this application."
}{
"error": "Application not found or you do not have permission to access it."
}{
"error": "File upload limit reached, please try again later"
}{
"error": "Error from worker: Erro ao criar arquivo: ENOENT: no such file or directory"
}File System
/v1/apps/{appId}/files/create
This endpoint creates a directory, or creates or overwrites a text file of an application.
POST
/
v1
/
apps
/
{appId}
/
files
/
create
cURL
curl --request POST \
--url https://api.camposcloud.com/v1/apps/{appId}/files/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"path": "src",
"name": "config.json",
"isDirectory": false,
"content": "{ \"debug\": false }"
}
'import requests
url = "https://api.camposcloud.com/v1/apps/{appId}/files/create"
payload = {
"path": "src",
"name": "config.json",
"isDirectory": False,
"content": "{ \"debug\": false }"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
path: 'src',
name: 'config.json',
isDirectory: false,
content: '{ "debug": false }'
})
};
fetch('https://api.camposcloud.com/v1/apps/{appId}/files/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.camposcloud.com/v1/apps/{appId}/files/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'path' => 'src',
'name' => 'config.json',
'isDirectory' => false,
'content' => '{ "debug": false }'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.camposcloud.com/v1/apps/{appId}/files/create"
payload := strings.NewReader("{\n \"path\": \"src\",\n \"name\": \"config.json\",\n \"isDirectory\": false,\n \"content\": \"{ \\\"debug\\\": false }\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.camposcloud.com/v1/apps/{appId}/files/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"path\": \"src\",\n \"name\": \"config.json\",\n \"isDirectory\": false,\n \"content\": \"{ \\\"debug\\\": false }\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.camposcloud.com/v1/apps/{appId}/files/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"path\": \"src\",\n \"name\": \"config.json\",\n \"isDirectory\": false,\n \"content\": \"{ \\\"debug\\\": false }\"\n}"
response = http.request(request)
puts response.read_body{
"message": "File created successfully"
}{
"error": "'content' must be a string when 'isDirectory' is false."
}{
"error": "Invalid developer token"
}{
"error": "You do not have permission to perform this action on this application."
}{
"error": "Application not found or you do not have permission to access it."
}{
"error": "File upload limit reached, please try again later"
}{
"error": "Error from worker: Erro ao criar arquivo: ENOENT: no such file or directory"
}This endpoint has a rate limit of 1 request every 3 seconds, shared with the other endpoints that change files (upload, delete, rename, move and create).
An existing file with the same name is overwritten without confirmation.
The request body is limited to 100 KB and the content is saved as UTF-8 text. For binary or larger files, send a
.zip to the upload endpoint.To edit a file: read it with
GET /v1/apps/{appId}/files?path=..., send the new content to this endpoint, then restart the application so it loads the change.Authorizations
Body
application/json