Giter Site home page Giter Site logo

a-why-not-fork-repositories-good-luck / sendanywhere-web-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from estmob/sendanywhere-web-api

0.0 1.0 0.0 13 KB

The simplest way to Send files Anywhere

Home Page: https://send-anywhere.com

Shell 15.88% HTML 65.15% Batchfile 18.97%

sendanywhere-web-api's Introduction

Send Anywhere Web API

Getting Started

To use the APIs, you need to pass your API key.

Ways to Pass Your Key:

HTTP Header

Pass the API key into the X-Api-Key header.

curl -H 'X-Api-Key: YOUR_API_KEY' 'https://send-anywhere.com/web/v1/device'

Get Query Parameter

Pass the API key into the api_key GET query string parameter.

curl 'https://send-anywhere.com/web/v1/device?api_key=YOUR_API_KEY'

HTTP Basic Auth Username

Pass the API key as the username (without password) using HTTP basic authentication.

curl 'https://[email protected]/web/v1/device'

Examples

Register Device

To use the API, you need to have a unique device_key in your cookie or query parameters.

curl -c $COOKIE_FILE "https://send-anywhere.com/web/v1/device?api_key=$API_KEY&profile_name=Send%20Anywhere%20SDK"

Send Files

To send files, create an 6-digit KEY then you'll get a target link to upload files.

Request Sample (with jQuery)
$.ajax({url: 'https://send-anywhere.com/web/v1/key',
	type: 'GET',
	dataType: 'jsonp',
	api_key: YOUR_API_KEY
	cache: false
}).done(function (data) {
    // `data.key` is an 6-digit KEY.
    // `data.weblink` is a target link.
});

Receive files

To receive files, query an 6-digit KEY then you'll get a target link to download files.

Request Sample (with jQuery)
$.ajax({url: 'https://send-anywhere.com/web/v1/key/123456',
	type: 'GET',
	dataType: 'jsonp',
	api_key: YOUR_API_KEY,
	timeout: 3000,
	cache: false
}).done(function (data) {
	// data.weblink is a target link.
});

Cross Domain Request

We support JSONP which can be used by passing a callback parameter in the query string of the URL you are requesting.

Web API Reference

The base URL for API endpoints is:

  https://send-anywhere.com

HTTP Response Status

  • 200 - OK
  • 400 - Bad Request. Invalid request query string.
  • 403 - Forbidden. Invalid api_key.
  • 404 - Not Found. Invalid key
  • 429 - Too Many Request. To keep the amount of spam on Send Anywhere as low as possible.
  • 500 - Internal Server Error. Something went wrong on our side. We're very sorry.

GET /web/v1/device

Create an unique device_key for your client. If device_key already exists, just update the device.

Parameters
profile_name Client device name
Response Cookies
device_key Unique device key

GET /web/v1/key

Generate a 6-digit key for sending files.

Parameters
file File list
Request Cookies
device_key Unique device key
Response
key Generated key
weblink Upload URL
Request Sample
{
  "file":[ { "name": "file1.txt", "size": 1}, { "name": "file2.txt", "size": 2} ]
}
Response Sample
{
  "key":"123456",
  "weblink":"https://file.send-anywhere.com/api/webfile/123456"
}

/web/v1/key/{KEY}

Query a 6-digit key for receiving files.

Request Cookies
device_key Unqiue device key
Response
key Requested key
weblink Download URL

Response Sample

{
  "key":"123456",
  "weblink":"https://file.send-anywhere.com/api/webfile/123456"
}

sendanywhere-web-api's People

Contributors

rtk-retanerz avatar sleephi avatar yth0625 avatar

Watchers

 avatar

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.