read_text_file_from_project

  • id: A unique UUID for the query
  • project_id: id of project containing file to be read (or array of project_id’s) (required)
  • path: path to file to be read in target project (or array of paths) (required)

Read a text file in the project whose id is supplied. User must be owner or collaborator in the target project. Argument ‘path’ is relative to home directory in target project. Unix user in the target project must have permissions to read file and containing directories if they do not already exist.

You can also read multiple project_id/path’s at once by making project_id and path arrays (of the same length). In that case, the result will be an array of {project_id, path, content} objects, in some random order. If there is an error reading a particular file, instead {project_id, path, error} is included.

Example:

Read a text file.

curl -u sk_abcdefQWERTY090900000000: \
  -d project_id=e49e86aa-192f-410b-8269-4b89fd934fba \
  -d path=Assignments/A1/h1.txt \
  https://cocalc.com/api/v1/read_text_file_from_project
==> {"event":"text_file_read_from_project",
     "id":"481d6055-5609-450f-a229-480e518b2f84",
     "content":"hello"}

This information is based on 2460511947 exported at 2019-05-04T08:09:48.370Z.