Files
You can use the API to get or upload binary files.
Upload a user file
Section titled “Upload a user file”POST https://api.pingstreams.com/v3/files/users
Allows to upload an file with autentication
Headers
Section titled “Headers”| Header | Type | Description |
|---|---|---|
Authorization | string | authorization token. Basic Auth or JWT |
Content-Type | string | use “multipart/form-data” value |
Request Body
Section titled “Request Body”| Field | Type | Description |
|---|---|---|
file | binary | the binary file |
Response
Section titled “Response”{
"message":"File uploded successfully",
"filename":"uploads/users/5ebd890292befe0019054973/files/27a8e524-d854-4aff-a6c7-84cb02681f34/README.md"
}Example:
Section titled “Example:”curl -v -X POST -H 'Content-Type: multipart/form-data' -u user@example.com:123456 -F file=@/Users/andrealeo/dev/chat21/pingstreams-server-dev-org/README.md https://api.pingstreams.com/v3/files/usersGet the binary file as stream by filename path
Section titled “Get the binary file as stream by filename path”GET https://api.pingstreams.com/v3/files
Headers
Section titled “Headers”| Header | Type | Description |
|---|---|---|
Authorization | string | authorization token. Basic Auth or JWT |
Response
Section titled “Response”Returns binary file data as stream.
Example
Section titled “Example”curl -v -X GET -H -u user@example.com:123456 https://api.pingstreams.com/v3/files?path=uploads/users/5ebd890292befe0019054973/files/27a8e524-d854-4aff-a6c7-84cb02681f34/README.mdDownload the binary file by filename path
Section titled “Download the binary file by filename path”GET https://api.pingstreams.com/v3/files/download
Headers
Section titled “Headers”| Header | Type | Description |
|---|---|---|
Authorization | string | authorization token. Basic Auth or JWT |
Response
Section titled “Response”Returns binary file data for download.
Example
Section titled “Example”curl -v -X GET -H -u user@example.com:123456 https://api.pingstreams.com/v3/files/download?path=uploads/users/5ebd890292befe0019054973/files/27a8e524-d854-4aff-a6c7-84cb02681f34/README.md