Files

Files represent files associated with a client. They can be used to store additional information about a client.

The File object

Properties

  • idstring

    The id of the file.

  • namestring

    The name of the file.

  • shareOnJobsboolean

    True if the file is shared on jobs.

  • sizenumber

    The size of the file.

  • createdAtdate

    The date and time the entity was created.

Client object

{
  "id": "65af6f23014c1c7a227e890f",
  "name": "Ref material.pdf",
  "shareOnJobs": false,
  "size": 487477,
  "createdAt": "2024-01-23T07:47:47.440Z",
}

GET/v2/clients/:id/files

List all files

This endpoint allows you to retrieve all the files for a client.

Request

GET
/v2/clients/:id/files
curl -G https://api.lsp.expert/v2/clients/6548c72a13162e1d7ade0290/files \
  -u {key}: 

Response

[
  {
    "id": "65af6f23014c1c7a227e890f",
    "name": "Ref material.pdf",
    "shareOnJobs": false,
    "size": 487477,
    "createdAt": "2024-01-23T07:47:47.440Z",
  },
  {...},
  {...}
]

POST/v2/clients/:id/files/upload

Upload a file

This endpoint allows you to upload a file .

Parameters

  • fileobject

    A file to upload. Make sure that the specifications follow RFC 2388, which defines file transfers for the multipart/form-data protocol.

Request

POST
/v2/clients/:id/files/upload
curl https://api.lsp.expert/v2/clients/6548c72a13162e1d7ade0290/files/upload \
  -u {key}: \
  -F file="@/path/to/a/file.jpg"

Response

{
  "id": "6548c72a13162e1d7ade0291",
  "name": "file.jpg",
  "shareOnJobs": false,
  "size": 487477,
  "createdAt": "2024-01-23T07:47:47.440Z",
}


GET/v2/clients/:id/files/:fileId/download

Download a file

This endpoint allows you to download a file for a client.

Request

GET
/v2/clients/:id/files/:fileId
curl https://api.lsp.expert/v2/clients/66f1313f9e477f90664d1ad8/files/6548c72a13162e1d7ade0291 \
  -u {key}:

PUT/v2/clients/:id/files/:fileId/share/with-jobs

Set shareable with jobs

This endpoint allows you to set a file as shareable with jobs.

Parameters

    Request

    PUT
    /v2/clients/:id/files/:fileId/share/with-jobs
    curl -X PUT https://api.lsp.expert/v2/clients/66f1313f9e477f90664d1ad8/files/6548c72a13162e1d7ade0291/share/with-jobs \
      -u {key}: 
    

    Response

    {
      "id": "6548c72a13162e1d7ade0291",
      "name": "file.jpg",
      "shareOnJobs": true,
      "size": 487477,
      "createdAt": "2024-01-23T07:47:47.440Z",
    }
    

    DEL/v2/clients/:id/files/:fileId/share/with-jobs

    Unset shareable with jobs

    This endpoint allows you to unset a file as shareable with jobs.

    Parameters

      Request

      DEL
      /v2/clients/:id/files/:fileId/share/with-jobs
      curl -X DEL https://api.lsp.expert/v2/clients/66f1313f9e477f90664d1ad8/files/6548c72a13162e1d7ade0291/share/with-jobs \
        -u {key}: 
      

      Response

      {
        "id": "6548c72a13162e1d7ade0291",
        "name": "file.jpg",
        "shareOnJobs": false,
        "size": 487477,
        "createdAt": "2024-01-23T07:47:47.440Z",
      }
      

      DELETE/v2/clients/:id/files/:fileId

      Delete a file

      This endpoint allows you to delete a file.

      Request

      DELETE
      /v2/clients/:id/files/:fileId
      curl -X DELETE https://api.lsp.expert/v2/clients/:66f1313f9e477f90664d1ad8/files/6548c72a13162e1d7ade0291 \
        -u {key}: