Git Product home page Git Product logo

osx-file-browser's Introduction

API

URL:

http://198.211.123.33:9998

AUTH NOTE:

Every request to API Server should be signed using JWT Token received on /auth/login call with credentials provided for test.

Example for HTTP Header is like below (suppose that token value received is AAABBBCCCC...):

Authorization: Bearer AAABBBCCCC...

Security:

JWT Token via Authorization Header Field. Example:

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Users on API

{
    "username": "test",
    "email": "[email protected]",
    "password": "ohiCanRun1"
},
{
    "username": "test2",
    "email": "[email protected]",
    "password": "ohiCanRun2"
}

ENDPOINTS

Login:

[POST] /auth/login

Params:

  • username
  • password

Example:

Request:

curl --request POST \
  --url http://198.211.123.33:9998/auth/login \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data 'username=test&password=ohiCanRun1'

Response:

{
    "status": 200,
    "data": {
        "token": "eyJhbGciOiJIUzI..."
    },
    "meta": {}
}

where token field contains value for future Bearer Authentication via headers (i.e. JWT Auth).


List Files:

[GET] /file

Example:

Request:

  curl --request GET \
  --url http://198.211.123.33:9998/file \
  --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'

Response:

{
	"status": 200,
	"data": [
		{
			"originalname": "4Yo7NDy.jpg",
			"filename": "e521edc0-fa16-11e7-b2af-45c3347d17b6",
			"mimetype": "image/jpeg",
			"size": 232449
		}
	],
	"meta": {}
}

Upload File:

[POST] /file

NOTE: Used content-type: multipart/form-data type so uploading file being streamed to server.

NOTE: File Field in request should be named secfile

NOTE: Limit for file size is 200 KB

Example:

Request:

curl --request POST \
  --url http://198.211.123.33:9998/file \
  --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form secfile=

Response:

{
    "status": 200,
    "data": {
        "originalname": "4Yo7NDy.jpg",
        "filename": "e521edc0-fa16-11e7-b2af-45c3347d17b6",
        "mimetype": "image/jpeg",
        "size": 232449
    },
    "meta": {}
}

Download File:

[GET] /file/{filename}

Example:

Request:

curl --request GET \
  --url http://198.211.123.33:9998/file/e521edc0-fa16-11e7-b2af-45c3347d17b6 \
  --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'

Response:

Response with file data is streamed back to client, with following headers as example

< HTTP/1.1 200 OK
< content-type: image/jpeg
< cache-control: no-cache
< Date: Mon, 15 Jan 2018 17:18:52 GMT
< Connection: keep-alive
< Transfer-Encoding: chunked

osx-file-browser's People

Stargazers

Petro Korienev avatar Alexander Saenko avatar

Watchers

Daniel Lisovoy avatar

osx-file-browser's Issues

Add reachability state

Implement reachability state to fetch data automatically in case of losing connection

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.