Dispra Docs

Cloud › Services

Check a file on the branch

GET https://devapi.dispralabs.com/v1/cloud/services/:svc/source/file

Whether a file, such as a Dockerfile, is in the service's repository on a branch (default the service's own).

Needs a key with read access or more.

  • Authentication: Secret key (send it as Authorization: Bearer <key>)

Parameters

  • svc string, required: The service's id. Example: svc_01jdk3n2f4g6h8j0k2l4z6x8ca
  • path string, required: The file, relative to the repository. Example: apps/api/Dockerfile
  • branch string, optional: The branch (default the service's). Example: main

Returns

  • 200: path, branch, found and checked.

Errors

StatusCodeWhen
400invalid_requestA field is missing or not valid. The message names it.
404not_foundNo such object in the key's project (or environment).

Request samples

Dispra Cloud CLI

dcloud api GET /v1/cloud/services/svc_01jdk3n2f4g6h8j0k2l4z6x8ca/source/file?path=apps%2Fapi%2FDockerfile&branch=main

cURL

curl "https://devapi.dispralabs.com/v1/cloud/services/svc_01jdk3n2f4g6h8j0k2l4z6x8ca/source/file?path=apps%2Fapi%2FDockerfile&branch=main" \
  -H "Authorization: Bearer dsp_live_YOUR_KEY"

Node

const res = await fetch("https://devapi.dispralabs.com/v1/cloud/services/svc_01jdk3n2f4g6h8j0k2l4z6x8ca/source/file?path=apps%2Fapi%2FDockerfile&branch=main", {
  method: "GET",
  headers: { Authorization: "Bearer dsp_live_YOUR_KEY" },
});
console.log(await res.json());

Python

import requests
res = requests.request("GET", "https://devapi.dispralabs.com/v1/cloud/services/svc_01jdk3n2f4g6h8j0k2l4z6x8ca/source/file", headers={"Authorization": "Bearer dsp_live_YOUR_KEY"}, params={"path": "apps/api/Dockerfile", "branch": "main"})
print(res.json())

Go

req, _ := http.NewRequest("GET", "https://devapi.dispralabs.com/v1/cloud/services/svc_01jdk3n2f4g6h8j0k2l4z6x8ca/source/file?path=apps%2Fapi%2FDockerfile&branch=main", nil)
req.Header.Set("Authorization", "Bearer dsp_live_YOUR_KEY")
res, _ := http.DefaultClient.Do(req)

Responses

200

{}

400 invalid_request

{
  "error": {
    "code": "invalid_request",
    "message": "A field is missing or not valid. The message names it.",
    "request_id": "req_7f3a9c21d84be056"
  }
}

404 not_found

{
  "error": {
    "code": "not_found",
    "message": "No such object in the key's project (or environment).",
    "request_id": "req_7f3a9c21d84be056"
  }
}