SugarSync 의 API 요약
17769 단어 rsync
App 이 SugarSync 네트워크 디스크 를 지원 하 는 전제 조건:
1、AccessKeyID:xxx
2、Private Access Key:xxx
3、AppID:xxx
자세 한 API 요약 은 다음 과 같 습 니 다.
Creating a Refresh Token
HTTP Request Example
POST https://api.sugarsync.com/app-authorization HTTP/1.1 User-Agent: Jakarta Commons-HttpClient/3.1 Host: api.sugarsync.com Content-Length: 364 Content-Type: application/xml; charset=UTF-8 <?xml version="1.0" encoding="UTF-8" ?> <appAuthorization> <username>[email protected]</username> <password>sugar20P$</password> <application>/sc/10061/3_21053</application> <accessKeyId>AKIAJTXL5NNLKNIAEORA</accessKeyId> <privateAccessKey>QAzJKVkzSXbIXWFwEPbzmRYmP8VmdLyNn33AvjRP</privateAccessKey> </appAuthorization> Response Example
HTTP/1.1 201 Created Content-Type: application/xml; charset=UTF-8 Date: Wed, 28 Mar 2012 19:29:00 GMT Location: https://api.sugarsync.com/app-authorization/A31303036322f335f3237303337 Access-Control-Allow-Origin: * Server: Noelios-Restlet-Engine/1.1.5 Transfer-Encoding: chunked 200-299
The request was successful. The refresh token was created.
400
Bad request. Typically returned if required information, such as the username, was not provided as input.
401
Authorization required. The presented credentials, if any, were not sufficient to access the resource.
500-599
Server error.
설명:
Creating an Access Token
HTTP Request Example
POST https://api.sugarsync.com/authorization HTTP/1.1 User-Agent: Jakarta Commons-HttpClient/3.1 Host: api.sugarsync.com Content-Length: 358 Content-Type: application/xml; charset=UTF-8 <?xml version="1.0" encoding="UTF-8" ?> <tokenAuthRequest> <accessKeyId>AKIAJTXL5NNLKNIAEORA</accessKeyId> <privateAccessKey>QAzJKVkzSXbIXWFwEPbzmRYmP8VmdLyNn33AvjRP</privateAccessKey> <refreshToken>https://api.sugarsync.com/app-authorization/A31303036322f335f3237303337</refreshToken> </tokenAuthRequest> Response Example
HTTP/1.1 201 Created Content-Type: application/xml; charset=UTF-8 Date: Wed, 28 Mar 2012 19:30:44 GMT Location: https://api.sugarsync.com/authorization/SmZ8zlrkR8j0oefVmmD4dUD83 Access-Control-Allow-Origin: * Server: Noelios-Restlet-Engine/1.1.5 Transfer-Encoding: chunked <?xml version="1.0" encoding="utf-8"?> <authorization> <expiration>2012-03-28T23:30:44.463+03:00</expiration> <user>https://api.sugarsync.com/user/5664947</user> </authorization> 설명:
Retrieving User Information
HTTP Request Example
GET https://api.sugarsync.com/user/566494 HTTP/1.1 Authorization: https://api.sugarsync.com/authorization/SmZ8zlrkR8j0oefVmmD4dUD83... User-Agent: Jakarta Commons-HttpClient/3.1 Host: api.sugarsync.com Response Example
HTTP/1.1 200 OK Content-Type: application/xml; charset=UTF-8 Date: Fri, 22 Oct 2011 08:01:54 GMT Access-Control-Allow-Origin: * Server: Noelios-Restlet-Engine/1.1.5 Transfer-Encoding: chunked <?xml version="1.0" encoding="UTF-8"?> <user> <username>[email protected]</username> <nickname>jsmith</nickname> <quota> <limit>2000000000</limit> <usage>345000000</usage> <salt>8ijYg==</salt> </quota> <workspaces>https://api.sugarsync.com/user/566494/workspaces/contents</workspaces> <syncfolders>https://api.sugarsync.com/566494/folders/contents</syncfolders> <deleted>https://api.sugarsync.com/folder/:sc:566494:9</deleted> <magicBriefcase>https://api.sugarsync.com/folder/:sc:566494:2</magicBriefcase> <webArchive>https://api.sugarsync.com/folder/:sc:566494:1</webArchive> <mobilePhotos>https://api.sugarsync.com/folder/:sc:566494:3</mobilePhotos> <albums>https://api.sugarsync.com/566494/albums/contents<albums/> <recentActivities>https://api.sugarsync.com/user/566494/recentActivities/contents</recentActivities> <receivedShares>https://api.sugarsync.com/user/566494/receivedShares/contents</receivedShares> <publicLinks>https://api.sugarsync.com/user/566494/publicLinks/contents</publicLinks> <maximumPublicLinkSize>25</maximumPublicLinkSize> </user> 설명:
1. 이 요청 헤더 의 Authorization 은 모두 accessToken 이 며, 반드시
2. Xml 에는 인자 가 많 습 니 다. 주로 syncfolders 와 magicBriefcase 두 개의 인자 에 관심 을 가 집 니 다.
3. Syncfolders 는 네트워크 루트 디 렉 터 리 를 표시 합 니 다. 기본적으로 하위 폴 더 'My SugarSync' 가 있 으 며 자동 으로 생 성 되 며 이 폴 더 를 편집 할 수 없습니다.
4. magicBriefcase 는 폴 더 "My SugarSync" 를 표시 합 니 다.
5. 특히 Sugarsync 네트워크 는 루트 디 렉 터 리 에 파일 을 만 드 는 것 을 지원 하지 않 으 며 폴 더 만 들 수 있 으 며 My SugarSync 폴 더 는 고정 되 어 있 고 하위 디 렉 터 리 는 제한 이 없 기 때문에 디 렉 터 리 아래 에 응용 루트 디 렉 터 리 를 만 들 수 있 습 니 다.
Retrieving Folder Contents
HTTP Request Example
GET https://api.sugarsync.com/folder/:sc:566494:5/contents HTTP/1.1 Authorization: https://api.sugarsync.com/authorization/SmZ8zlrkR8j0oefVmmD4dUD83... User-Agent: Jakarta Commons-HttpClient/3.1 Host: api.sugarsync.com Response Example
HTTP/1.1 200 OK Content-Type: application/xml; charset=UTF-8 Date: Tue, 29 Nov 2011 23:06:11 GMT Access-Control-Allow-Origin: * Server: Noelios-Restlet-Engine/1.1.5 Transfer-Encoding: chunked <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <collectionContents start="0" hasMore="false" end="4"> <collection type="folder"> <displayName>100ANDRO</displayName> <ref>https://api.sugarsync.com/folder/:sc:566494:6552993_17248</ref> <contents>https://api.sugarsync.com/folder/:sc:566494:6552993_17248/contents</contents> </collection> <collection type="folder"> <displayName>2010-10-10</displayName> <ref>https://api.sugarsync.com/folder/:sc:566494:6552993_17250</ref> <contents>https://api.sugarsync.com/folder/:sc:566494:6552993_17250/contents</contents> </collection> <file> <displayName>AbeLincoln.jpg</displayName> <ref>https://api.sugarsync.com/file/:sc:566494:6552993_17252</ref> <size>38539</size> <lastModified>2010-02-11T15:26:52.000-08:00</lastModified> <mediaType>image/jpeg</mediaType> <presentOnServer>true</presentOnServer> <fileData>https://api.sugarsync.com/file/:sc:566494:6552993_17252/data</fileData> </file> <file> <displayName>GeorgeWashington.jpg</displayName> <ref>https://api.sugarsync.com/file/:sc:566494:6552993_17254</ref> <size>956022</size> <lastModified>2011-11-11T07:48:10.000-08:00</lastModified> <mediaType>image/jpeg</mediaType> <presentOnServer>true</presentOnServer> <fileData>https://api.sugarsync.com/file/:sc:566494:6552993_17254/data</fileData> </file> </collectionContents> 설명:
1. 시 도 를 통 해 실례 에서 url 이 일반 경 로 를 대표 하 는 것 을 발 견 했 지만 루트 디 렉 터 리 에 접근 할 때 이전 api 에서 얻 은 syncdolders 파라미터 가 필요 합 니 다
2. 일반 파일 이나 폴 더 의 id 는 "sc: 사용자 id: 폴 더 표지 id" 입 니 다. 부모 폴 더 를 요청 하여 contents 를 얻 을 수 있 습 니 다. body 의 "ref" 인 자 는 파일 이나 폴 더 id 입 니 다.
3. 요청 할 때 url 뒤에 '? type = folder' 또는 '? type = file' 을 추가 하여 각각 파일 이나 폴 더 집합 을 얻 을 수 있 습 니 다.
4. 수정 시간 역시 세계 시간 UTC
Creating a Folder
HTTP Request Example
POST https://api.sugarsync.com/folder/:sc:566494:4 HTTP/1.1 Authorization: https://api.sugarsync.com/authorization/SmZ8zlrkR8j0oefVmmD4dUD83... User-Agent: Jakarta Commons-HttpClient/3.1 Host: api.sugarsync.com Content-Length: 294 Content-Type: application/xml; charset=UTF-8 <?xml version="1.0" encoding="UTF-8" ?> <folder> <displayName>work-docs</displayName> </folder> Response Example
HTTP/1.1 201 Created Content-Type: application/octet-stream; charset=UTF-8 Content-Length: 0 Date: Wed, 14 Dec 2011 19:35:02 GMT Location: https://api.sugarsync.com/folder/:sc:566494:190_123294339 Access-Control-Allow-Origin: * Server: Noelios-Restlet-Engine/1.1.5 설명:
1. 오류 가 계속 되 돌아 오 면 accessToken 과 폴 더 이름 이 정확 하 다 는 전제 에서 url 에 문제 가 있 고 폴 더 부모 폴 더 id 가 잘못 되 었 습 니 다.
2. Body 에서 location 은 폴 더 를 만 들 기 위 한 uri 입 니 다.
Deleting a Folder
HTTP Request Example
DELETE https://api.sugarsync.com/folder/:sc:566494:190_123279794 HTTP/1.1 User-Agent: Jakarta Commons-HttpClient/3.1 Host: api.sugarsync.com Content-Length: 294 Content-Type: application/xml; charset=UTF-8 Response example
HTTP/1/1 204 No Content Content-Type: application/octet-stream; charset=UTF-8 Content-Length: 0 Date: Tue, 20 Dec 2011 18:29:20 GMT Access-Control-Allow-Origin: * Server: Noelios-Restlet-Engine/1.1.5 Deleting a File
HTTP Request Example
DELETE https://api.sugarsync.com/file/:sc:566494:190_138381019 HTTP/1.1 Authorization: https://api.sugarsync.com/authorization/SmZ8zlrkR8j0oefVmmD4dUD83... User-Agent: Jakarta Commons-HttpClient/3.1 Host: api.sugarsync.com Response Example
HTTP/1/1 204 No Content Content-Type: application/octet-stream; charset=UTF-8 Content-Length: 0 Date: Tue, 03 Jan 2012 21:24:45 GMT Access-Control-Allow-Origin: * Server: Noelios-Restlet-Engine/1.1.5 Retrieving File Data
HTTP Request Example
GET https://api.sugarsync.com/file/:sc:566494:6552993_66025/data HTTP/1.1 Authorization: https://api.sugarsync.com/authorization/SmZ8zlrkR8j0oefVmmD4dUD83... User-Agent: Jakarta Commons-HttpClient/3.1 Host: api.sugarsync.com Response Example
HTTP/1.1 200 OK Content-Type: application/xml; charset=UTF-8 Content-Length: 1502167 Date: Wed, 04 Jan 2012 19:31:29 GMT Accept-Ranges: bytes Content-Disposition: attachment; filename*=UTF-8''PineCreek5_120411.jpg Access-Control-Allow-Origin: * Server: Noelios-Restlet-Engine/1.1.5 설명:
url 은 사실 file 의 uri 에 '/ data' 를 더 한 것 입 니 다.
Creating a File
HTTP Request Example
POST https://api.sugarsync.com/folder/:sc:566494:5 HTTP/1.1 Authorization: https://api.sugarsync.com/authorization/SmZ8zlrkR8j0oefVmmD4dUD83... User-Agent: Jakarta Commons-HttpClient/3.1 Host: api.sugarsync.com Content-Length: 294 Content-Type: application/xml; charset=UTF-8 <?xml version="1.0" encoding="UTF-8" ?> <file> <displayName>Winter2012.jpg</displayName> <mediaType>image/jpeg</mediaType> </file> Response Example
HTTP/1.1 201 Created Content-Type: application/octet-stream; charset=UTF-8 Content-Length: 0 Date: Mon, 02 Jan 2012 22:27:00 GMT Location: https://api.sugarsync.com/file/:sc:566494:190_137264710 Access-Control-Allow-Origin: * Server: Noelios-Restlet-Engine/1.1.5 설명:
1. 이 api 는 upload file 과 함께 사 용 됩 니 다.SugarSync 는 id 로 파일 과 폴 더 를 표시 하기 때문에 파일 을 업로드 하기 전에 파일 에 먼저 자리 차지 id 를 만들어 야 합 니 다.
2. 요청 한 body 에서 만 든 파일 이름과 파일 형식 입 니 다.
Uploading File Data
HTTP Request Example
PUT https://api.sugarsync.com/file/:sc:566494:6552993_66025/data HTTP/1.1 Authorization: https://api.sugarsync.com/authorization/SmZ8zlrkR8j0oefVmmD4dUD83... User-Agent: Jakarta Commons-HttpClient/3.1 Host: api.sugarsync.com Content-Length: 1431 Response Example
HTTP/1.1 204 OK Content-Type: application/octet-stream; charset=UTF-8 Content-Length: 0 Date: Wed, 04 Jan 2012 21:58:25 GMT Access-Control-Allow-Origin: * Server: Noelios-Restlet-Engine/1.1.5
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
VPS의 데이터를 가정용 PC에 백업(rsync, OpenVPN)나중에 조사해 보면 상당한 힘 기술 같다. 복원시에는 주의를. 글쎄, 긴급시의 설비용으로. 공통 우분투 15.04 OpenVPN 2.3.2 rsync 3.1.1 백업 소스. VPN 서버. 백업 대상. VPN 클라이언...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.