### Start a build with current settings (Go) Source: https://northflank.com/docs/v1/api/project/jobs/start-job-build.md Implement starting a job build in Go using the net/http package. This example demonstrates setting headers and sending the request body. ```go package main import ( "bytes" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.northflank.com/v1/projects/{projectId}/jobs/{jobId}/build" var jsonStr = []byte(`{"sha":"262ed9817b3cad5142fbceabe0c9e371e390d616"}`) req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer NORTHFLANK_API_TOKEN") client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() fmt.Println("Response status:", resp.Status) fmt.Println("Response headers:", resp.Header) body, _ := ioutil.ReadAll(resp.Body) fmt.Println("Response body:", string(body)) } ``` -------------------------------- ### Start a build with overrides (Python) Source: https://northflank.com/docs/v1/api/project/jobs/start-job-build.md This Python example shows how to send a POST request to start a build with specified overrides, including build arguments and Docker configurations. ```python import requests url = "https://api.northflank.com/v1/projects/{projectId}/jobs/{jobId}/build" payload = {"sha":"262ed9817b3cad5142fbceabe0c9e371e390d616","overrides":{"buildArguments":{"ARGUMENT_1":"abcdef","ARGUMENT_2":"12345"},"buildFiles":{"/dir/fileName":{"data":"VGhpcyBpcyBhbiBleGFtcGxlIHdpdGggYSB0ZW1wbGF0ZWQgJHtOT0RFX0VOVn0gdmFyaWFibGU=","encoding":"utf-8"}},"dockerSecretMounts":{"example-secret-mount_1":{"data":"VGhpcyBpcyBhbiBleGFtcGxlIHdpdGggYSB0ZW1wbGF0ZWQgJHtOT0RFX0VOVn0gdmFyaWFibGU=","encoding":"utf-8"}},"docker":{"dockerFilePath":"/Dockerfile","dockerWorkDir":"/"}}} headers = {"Content-Type": "application/json", "Authorization": "Bearer NORTHFLANK_API_TOKEN"} response = requests.request("POST", url, headers = headers, json = payload) print(response.json()) ``` -------------------------------- ### JavaScript Client Example Source: https://northflank.com/docs/v1/api/project/services/get-service-build-arguments-details.md Example of how to call the get service build arguments details endpoint using the JavaScript client. ```APIDOC ## JavaScript client reference ### Example request ```javascript await apiClient.get.service.buildArgumentDetails({ parameters: { "projectId": "default-project", "serviceId": "example-service" } }); ``` ``` -------------------------------- ### Start a build with current settings (Python) Source: https://northflank.com/docs/v1/api/project/jobs/start-job-build.md Use the Python requests library to start a job build. This example sends the commit SHA to the Northflank API. ```python import requests url = "https://api.northflank.com/v1/projects/{projectId}/jobs/{jobId}/build" payload = {"sha":"262ed9817b3cad5142fbceabe0c9e371e390d616"} headers = {"Content-Type": "application/json", "Authorization": "Bearer NORTHFLANK_API_TOKEN"} response = requests.request("POST", url, headers = headers, json = payload) print(response.json()) ``` -------------------------------- ### Get Invoice Details API Response Source: https://northflank.com/docs/v1/api/org/billing/get-invoice-details.md This is an example of a successful API response when retrieving invoice details. It includes the billing period start and end timestamps, and tax information. ```json { "data": { "period": { "start": 1655823815, "end": 1655910214 }, "tax": { "percent": 20, "value": 200 } } } ``` -------------------------------- ### Start Service Build Request (Go) Source: https://northflank.com/docs/v1/api/project/services/start-service-build.md Starts a service build using Go's net/http package. This example includes setting up the HTTP request, headers, and handling the response. ```go package main import ( "bytes" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.northflank.com/v1/projects/{projectId}/services/{serviceId}/build" var jsonStr = []byte(`{"bundleUrl":"https://example.com/archive.tar"}`) req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer NORTHFLANK_API_TOKEN") client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() fmt.Println("Response status:", resp.Status) fmt.Println("Response headers:", resp.Header) body, _ := ioutil.ReadAll(resp.Body) fmt.Println("Response body:", string(body)) } ``` -------------------------------- ### Get Service Build JavaScript Client Example Source: https://northflank.com/docs/v1/api/project/services/get-service-build.md Example of how to get service build information using the JavaScript client. ```APIDOC ## JavaScript client reference ### Example request ```javascript await apiClient.get.service.build({ parameters: { "projectId": "default-project", "serviceId": "example-service", "buildId": "joyous-view-6290" } }); ``` ### Example Response Returns data about the specified build. ```json { "data": { "id": "joyous-view-6290", "branch": "main", "status": "SUCCESS", "sha": "12c15e7ee25fd78f567ebf87f9178b8ad70025b3", "concluded": true, "createdAt": "2021-07-28T15:55:38.296Z", "success": true, "message": "Image successfully built", "buildConcludedAt": 1606237973 }, "rawResponse": "...", "request": "...", "error": "..." } ``` ``` -------------------------------- ### Get Service Build Arguments JavaScript Client Reference Source: https://northflank.com/docs/v1/api/project/services/get-service-build-arguments.md This section shows an example of how to use the JavaScript client to get service build arguments, including parameters and an example response. ```APIDOC ## JavaScript client reference ### Example request ```javascript await apiClient.get.service.buildArguments({ parameters: { "projectId": "default-project", "serviceId": "example-service" }, options: { "show": "all", "replaceTemplatedValues": "true" } }); ``` ### Example Response The build arguments for the service. ```json { "data": { "buildArguments": { "ARGUMENT_1": "abcdef", "ARGUMENT_2": "12345" }, "buildFiles": { "/dir/fileName": { "data": "VGhpcyBpcyBhbiBleGFtcGxlIHdpdGggYSB0ZW1wbGF0ZWQgJHtOT0RFX0VOVn0gdmFyaWFibGU=", "encoding": "utf-8" } } }, "rawResponse": "...", "request": "...", "error": "..." } ``` ``` -------------------------------- ### JavaScript Client Example Source: https://northflank.com/docs/v1/api/team/backup-destinations/get-backup-destination.md Example of how to get a backup destination using the JavaScript client. ```APIDOC ## JavaScript Client ### Example Request ```javascript await apiClient.get.backupDestination({ parameters: { "backupDestinationId": "example-destination" } }); ``` ### Example Response Details of the backup destination. ```json { "data": { "name": "Example Backup Destination", "id": "example-backup-destination" }, "rawResponse": "...", "request": "...", "error": "..." } ``` ``` -------------------------------- ### Start Job Build Request Source: https://northflank.com/docs/v1/api/project/jobs/start-job-build.md Demonstrates how to construct and send a POST request to start a job build. Includes setting the Content-Type and Authorization headers, and handling the HTTP response. ```Go var jsonStr = []byte(`{"sha":"262ed9817b3cad5142fbceabe0c9e371e390d616","overrides":{"buildArguments":{"ARGUMENT_1":"abcdef","ARGUMENT_2":"12345"},"buildFiles":{"/dir/fileName":{"data":"VGhpcyBpcyBhbiBleGFtcGxlIHdpdGggYSB0ZW1wbGF0ZWQgJHtOT0RFX0VOVn0gdmFyaWFibGU=","encoding":"utf-8"}},"dockerSecretMounts":{"example-secret-mount_1":{"data":"VGhpcyBpcyBhbiBleGFtcGxlIHdpdGggYSB0ZW1wbGF0ZWQgJHtOT0RFX0VOVn0gdmFyaWFibGU=","encoding":"utf-8"}},"docker":{"dockerFilePath":"/Dockerfile","dockerWorkDir":"/"}}}`) req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer NORTHFLANK_API_TOKEN") client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() fmt.Println("Response status:", resp.Status) fmt.Println("Response headers:", resp.Header) body, _ := ioutil.ReadAll(resp.Body) fmt.Println("Response body:", string(body)) ``` -------------------------------- ### Initiate Volume Backup (Go) Source: https://northflank.com/docs/v1/api/project/volumes/backup-volume.md This Go program demonstrates how to make an HTTP POST request to initiate a volume backup. It includes setting headers, constructing the request body, and handling the response. ```go package main import ( "bytes" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.northflank.com/v1/projects/{projectId}/volumes/{volumeId}/backups" var jsonStr = []byte(`{"name":"Example Backup","description":"Example backup description"}`) req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer NORTHFLANK_API_TOKEN") client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() fmt.Println("Response status:", resp.Status) fmt.Println("Response headers:", resp.Header) body, _ := ioutil.ReadAll(resp.Body) fmt.Println("Response body:", string(body)) } ``` -------------------------------- ### CLI Example Response Source: https://northflank.com/docs/v1/api/team/backup-destinations/get-backup-destination.md This is an example of the output when using the CLI to get backup destination details. ```json { "name": "Example Backup Destination", "id": "example-backup-destination" } ``` -------------------------------- ### Get Pipeline JavaScript Client Reference Source: https://northflank.com/docs/v1/api/project/pipelines/get-pipeline.md Example of how to get pipeline details using the JavaScript client. ```APIDOC ### JavaScript client reference #### Example request ```javascript await apiClient.get.pipeline({ parameters: { "projectId": "default-project", "pipelineId": "example-pipeline" } }); ``` ### Example Response Details about a pipeline. ```json { "data": { "name": "example-pipeline", "nfObjects": [ { "id": "example-service", "type": "service", "stage": "Production" } ] }, "rawResponse": "...", "request": "...", "error": "..." } ``` ``` -------------------------------- ### Create Preview Environment using Go Source: https://northflank.com/docs/v1/api/project/pipelines/update-preview-template.md This Go program shows how to create a preview environment by making an HTTP POST request. It constructs the request with the appropriate headers and JSON body. Ensure you replace the placeholder values. ```go package main import ( "bytes" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.northflank.com/v1/projects/{projectId}/pipelines/{pipelineId}/preview-envs" var jsonStr = []byte(`{"apiVersion":"v1.2","options":{"concurrencyPolicy":"allow"},"gitops":{"vcsService":"github","accountLogin":"github-user","repoUrl":"https://github.com/northflank-examples/remix-postgres-redis-demo","branch":"main","filePath":"/Dockerfile"},"spec":{"kind":"Workflow","spec":{"type":"sequential"}},"paused":false,"triggers":[{"vcsService":"github","accountLogin":"github-user","repoUrl":"https://github.com/northflank-examples/remix-postgres-redis-demo","pathIgnoreRules":["README.md"],"ciIgnoreFlags":["[skip ci]"]}],"webhook":{"enabled":true,"regenerate":false}}`) req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer NORTHFLANK_API_TOKEN") client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() fmt.Println("Response status:", resp.Status) fmt.Println("Response headers:", resp.Header) body, _ := ioutil.ReadAll(resp.Body) fmt.Println("Response body:", string(body)) } ``` -------------------------------- ### Scale Service Request Example (Go) Source: https://northflank.com/docs/v1/api/project/services/scale-service.md This Go program illustrates how to scale a service by making an HTTP POST request. It includes setting up the request, headers, and handling the response. ```go package main import ( "bytes" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.northflank.com/v1/projects/{projectId}/services/{serviceId}/scale" var jsonStr = []byte(`{"instances":1,"deploymentPlan":"nf-compute-20","storage":{"ephemeralStorage":{"storageSize":1024}}}`) req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer NORTHFLANK_API_TOKEN") client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() fmt.Println("Response status:", resp.Status) fmt.Println("Response headers:", resp.Header) body, _ := ioutil.ReadAll(resp.Body) fmt.Println("Response body:", string(body)) } ``` -------------------------------- ### Get Addon Credentials (JavaScript Client) Source: https://northflank.com/docs/v1/api/project/addons/get-addon-credentials.md Example of how to get addon credentials using the JavaScript client. ```APIDOC ### JavaScript Client Example ```javascript await apiClient.get.addon.credentials({ parameters: { "projectId": "default-project", "addonId": "example-addon" } }); ``` ### Example Response Credentials for the addon. ```json { "data": { "secrets": { "username": "1720747439245d49", "password": "f1ba286ee2465e80b0fd4af31276f3e33a" }, "envs": {} }, "rawResponse": "...", "request": "...", "error": "..." } ``` ``` -------------------------------- ### Get Volume Backups JavaScript Client Example Source: https://northflank.com/docs/v1/api/project/volumes/get-volume-backups.md Example usage of the JavaScript client to retrieve volume backups. ```APIDOC ## JavaScript client reference ### Example request ```javascript await apiClient.get.volume.backups({ parameters: { "projectId": "default-project", "volumeId": "example-volume" }, options: { "per_page": 50, "page": 1 } }); ``` ### Example Response The list of volume backups. ```json { "data": [ { "id": "example-backup" } ], "pagination": { "hasNextPage": false, "count": 1 }, "rawResponse": "...", "request": "...", "error": "..." } ``` ``` -------------------------------- ### Go Example Source: https://northflank.com/docs/v1/api/project/jobs/create-manual-job.md Example of how to create a manual job using Go with the net/http package. ```go package main import ( "bytes" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.northflank.com/v1/projects/{projectId}/jobs/manual" var jsonStr = []byte(`{ "name": "Example Job", "description": "A job description", "billing": { "buildPlan": "nf-compute-200-8", "deploymentPlan": "nf-compute-20" }, "deployment": { "docker": { "configType": "default" }, "storage": { "ephemeralStorage": { "storageSize": 1024 } }, "vcs": { "projectUrl": "https://github.com/northflank/gatsby-with-northflank", "projectType": "github", "accountLogin": "github-user", "projectBranch": "master" } }, "buildConfiguration": { "pathIgnoreRules": [ "README.md" ], "isAllowList": false, "ciIgnoreFlags": [ "[skip ci]" ], "dockerCredentials": [ "example-docker-credential" ], "storage": { "ephemeralStorage": { "storageSize": 16384 } } }, "buildSettings": { "storage": { "ephemeralStorage": { "storageSize": 16384 } }, "dockerfile": { "buildEngine": "buildkit", "dockerFilePath": "/Dockerfile", "dockerWorkDir": "/", "buildkit": { "useCache": true, "cacheStorageSize": 32768 } } }, "runtimeEnvironment": { "variable1": "abcdef", "variable2": "12345" }, "runtimeFiles": { "/dir/fileName": { "data": "VGhpcyBpcyBhbiBleGFtcGxlIHdpdGggYSB0ZW1wbGF0ZWQgJHtOT0RFX0VOVn0gdmFyaWFibGU=", "encoding": "utf-8" } }, "buildArguments": { "variable1": "abcdef", "variable2": "12345" }, "buildFiles": { "/dir/fileName": { "data": "VGhpcyBpcyBhbiBleGFtcGxlIHdpdGggYSB0ZW1wbGF0ZWQgJHtOT0RFX0VOVn0gdmFyaWFibGU=", "encoding": "utf-8" } }, "dockerSecretMounts": { "example-secret-mount_1": { "data": "VGhpcyBpcyBhbiBleGFtcGxlIHdpdGggYSB0ZW1wbGF0ZWQgJHtOT0RFX0VOVn0gdmFyaWFibGU=", "encoding": "utf-8" } }, "healthChecks": [ { "protocol": "HTTP", "type": "readinessProbe", "path": "/health-check", "port": 8080, "initialDelaySeconds": 10, "periodSeconds": 60, "timeoutSeconds": 1, "failureThreshold": 3, "successThreshold": 1 } ], "backoffLimit": 0, "runOnSourceChange": "never", "activeDeadlineSeconds": 600 }`) req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer NORTHFLANK_API_TOKEN") client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() fmt.Println("Response status:", resp.Status) fmt.Println("Response headers:", resp.Header) body, _ := ioutil.ReadAll(resp.Body) fmt.Println("Response body:", string(body)) } ``` -------------------------------- ### Run Workflow with Go Source: https://northflank.com/docs/v1/api/project/workflows/run-workflow.md Initiate a workflow run using Go's standard net/http package. This example includes setting up the HTTP request with necessary headers and body. ```go package main import ( "bytes" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.northflank.com/v1/projects/{projectId}/workflows/{workflowId}/runs" var jsonStr = []byte(`{"name":"Example Run","description":"This is a description for the workflow run.","arguments":{"ARG_1":"value"},"overrides":{"example-ref":{"branch":"devel"}},"releaseNodeOverrides":{"example-service":{"type":"registry","origin":{"imagePath":"nginx:latest"}}}}`) req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer NORTHFLANK_API_TOKEN") client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() fmt.Println("Response status:", resp.Status) fmt.Println("Response headers:", resp.Header) body, _ := ioutil.ReadAll(resp.Body) fmt.Println("Response body:", string(body)) } ``` -------------------------------- ### Get Cluster JavaScript Request Source: https://northflank.com/docs/v1/api/org/cloud-providers/get-cluster.md Example of how to make a request to get cluster details using the JavaScript client library. ```javascript await apiClient.get.cloud.cluster({ parameters: { "clusterId": "gcp-cluster-1" } }); ``` -------------------------------- ### Start a build with current settings (JavaScript) Source: https://northflank.com/docs/v1/api/project/jobs/start-job-build.md Initiate a job build using JavaScript's fetch API. This example shows how to send the commit SHA for the build. ```javascript const payload = { "sha": "262ed9817b3cad5142fbceabe0c9e371e390d616" } const response = await fetch('https://api.northflank.com/v1/projects/{projectId}/jobs/{jobId}/build', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${NORTHFLANK_API_TOKEN}` }, body: JSON.stringify(payload) }) const json = await response.json() console.log(json) ``` -------------------------------- ### Get Tag JavaScript Client Example Source: https://northflank.com/docs/v1/api/team/tags/get-tag.md Example usage of the JavaScript client to retrieve details for a specific resource tag. ```APIDOC ## JavaScript client reference ### Example request ```javascript await apiClient.get.tag({ parameters: { "resourceTagId": "example-tag" } }); ``` ### Example Response Data about the resource tag. ```json { "data": { "useSpotNodes": false, "useOnDemandNodes": false, "color": "#57637A", "name": "Example Tag", "id": "example-tag", "createdAt": "2000-01-01T12:00:00.000Z" }, "rawResponse": "...", "request": "...", "error": "..." } ``` ``` -------------------------------- ### Get SSH Identity JavaScript Client Example Source: https://northflank.com/docs/v1/api/team/integrations/get-ssh-identity.md Example of how to retrieve SSH identity data using the JavaScript client. ```APIDOC ## JavaScript client reference ### Example request ```javascript await apiClient.get.sshIdentities({ parameters: { "identityId": "example-ssh-identity" } }); ``` ### Example Response Data about the SSH identity. ```json { "data": { "id": "example-identity", "name": "Example SSH Identity", "sshPublicKeys": [ { "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ..." } ], "restrictions": { "projects": { "enabled": false }, "tags": { "enabled": false, "matchCondition": "or" } } }, "rawResponse": "...", "request": "...", "error": "..." } ``` ``` -------------------------------- ### Start a build with overrides (JavaScript) Source: https://northflank.com/docs/v1/api/project/jobs/start-job-build.md Use JavaScript to start a build with overrides. This example demonstrates how to specify custom build arguments, files, Docker secret mounts, and Dockerfile paths. ```javascript const payload = { "sha": "262ed9817b3cad5142fbceabe0c9e371e390d616", "overrides": { "buildArguments": { "ARGUMENT_1": "abcdef", "ARGUMENT_2": "12345" }, "buildFiles": { "/dir/fileName": { "data": "VGhpcyBpcyBhbiBleGFtcGxlIHdpdGggYSB0ZW1wbGF0ZWQgJHtOT0RFX0VOVn0gdmFyaWFibGU=", "encoding": "utf-8" } }, "dockerSecretMounts": { "example-secret-mount_1": { "data": "VGhpcyBpcyBhbiBleGFtcGxlIHdpdGggYSB0ZW1wbGF0ZWQgJHtOT0RFX0VOVn0gdmFyaWFibGU=", "encoding": "utf-8" } }, "docker": { "dockerFilePath": "/Dockerfile", "dockerWorkDir": "/" } } } const response = await fetch('https://api.northflank.com/v1/projects/{projectId}/jobs/{jobId}/build', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${NORTHFLANK_API_TOKEN}` }, body: JSON.stringify(payload) }) const json = await response.json() console.log(json) ``` -------------------------------- ### Get Preview Template JavaScript Client Example Source: https://northflank.com/docs/v1/api/project/pipelines/get-preview-template.md Example of how to fetch preview template details using the JavaScript client. ```APIDOC ## JavaScript Client ### Example Request ```javascript await apiClient.get.previewTemplate({ parameters: { "projectId": "default-project", "pipelineId": "example-pipeline" }, options: { "per_page": 50, "page": 1 } }); ``` ### Response Example ```json { "data": { "apiVersion": "v1.2", "triggers": [ { "vcsService": "github", "accountLogin": "github-user", "repoUrl": "https://github.com/northflank-examples/remix-postgres-redis-demo", "pathIgnoreRules": [ "README.md" ], "ciIgnoreFlags": [ "[skip ci]" ] } ], "gitops": { "vcsService": "github", "accountLogin": "github-user", "repoUrl": "https://github.com/northflank-examples/remix-postgres-redis-demo", "branch": "main", "filePath": "/Dockerfile" }, "spec": { "kind": "Workflow", "spec": { "type": "sequential" } }, "id": "example-template", "paused": false }, "rawResponse": "...", "request": "...", "error": "..." } ``` ``` -------------------------------- ### Run Preview Blueprint using Go HTTP Client Source: https://northflank.com/docs/v1/api/project/preview-blueprints/run-preview-blueprint.md This Go program demonstrates how to make an HTTP POST request to run a preview blueprint. It sets up the request with the necessary headers and JSON body, sends it using the `net/http` client, and prints the response details. ```go package main import ( "bytes" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.northflank.com/v1/projects/{projectId}/preview-blueprints/{previewBlueprintId}/runs" var jsonStr = []byte(`{"name":"Example Run","description":"This is a description for the preview blueprint run.","arguments":{"ARG_1":"value"},"triggers":{"example-trigger":{"branch":"devel"}}}`) req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer NORTHFLANK_API_TOKEN") client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() fmt.Println("Response status:", resp.Status) fmt.Println("Response headers:", resp.Header) body, _ := ioutil.ReadAll(resp.Body) fmt.Println("Response body:", string(body)) } ``` -------------------------------- ### Example Request using Go Source: https://northflank.com/docs/v1/api/project/services/edit-service-runtime-environment.md This Go program demonstrates how to make an HTTP POST request to update a service's runtime environment. It constructs the request with the necessary headers and JSON payload. ```go package main import ( "bytes" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.northflank.com/v1/projects/{projectId}/services/{serviceId}/runtime-environment" var jsonStr = []byte(`{"runtimeEnvironment":{"VARIABLE_1":"abcdef","VARIABLE_2":"12345"},"runtimeFiles":{"/dir/fileName":{"data":"VGhpcyBpcyBhbiBleGFtcGxlIHdpdGggYSB0ZW1wbGF0ZWQgJHtOT0RFX0VOVn0gdmFyaWFibGU=","encoding":"utf-8"}}}`) req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer NORTHFLANK_API_TOKEN") client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() fmt.Println("Response status:", resp.Status) fmt.Println("Response headers:", resp.Header) body, _ := ioutil.ReadAll(resp.Body) fmt.Println("Response body:", string(body)) } ``` -------------------------------- ### List Preview Environments JavaScript Client Example Source: https://northflank.com/docs/v1/api/project/pipelines/list-preview-environments.md Example of how to list preview environments using the JavaScript client. ```APIDOC ## JavaScript client reference ### Example request ```javascript await apiClient.list.pipelineTemplatePreviews({ parameters: { "projectId": "default-project", "pipelineId": "example-pipeline" }, options: { "per_page": 50, "page": 1 } }); ``` ### Example Response ```json { "data": { "previewEnvironments": [ { "id": "clean-step", "paused": false } ] }, "pagination": { "hasNextPage": false, "count": 1 }, "rawResponse": "...", "request": "...", "error": "..." } ``` ```