Connector API v1

From Memsource
Jump to: navigation, search

List Connectors

action: /api2/v1/connectors
    token                       string
                                // method GET needs to be used

   
response: JSON

{
   "totalCount": 1,
   "connectors": [
       {
           "type": "DRUPAL",
           "createdAt": "2017-03-20T12:28:28+0000",
           "createdBy": {
               "id": "164885",
               "name": "Memsourcetutorials"
           },
           "id": "ZGyuB2Tgx6W1iWS0aTUkG9",
           "localToken": "909c94bd-59e5-4205-ae61-2a50a72f61fd",
           "automatedProjectSettings": null,
           "name": "Drupal Connector",
           "organization": {
               "id": "36214",
               "name": "Memsource Tutorials"
           }
       }
   ]
}

Get Connector Info

action: /api2/v1/connectors/{connectorId}
                           
                           // method GET needs to be used
                           // the entire {connectorId} section needs to be replaced with the actual Id
  
response: JSON
  
{
   "type": "DRUPAL",
   "createdAt": "2017-03-20T12:28:28+0000",
   "createdBy": {
       "id": "164885",
       "name": "Memsourcetutorials"
   },
   "id": "ZGyuB2Tgx6W1iWS0aTUkG9",
   "localToken": "909c94bd-59e5-4205-ae61-2a50a72f61fd",
   "automatedProjectSettings": [],
   "name": "Drupal Connector",
   "organization": {
       "id": "36214",
       "name": "Memsource Tutorials"
   }
}

Export to Online Repository

action: /api2/v1/connectors/{connectorId}/folders/{encodedName}
                          
                           // method POST needs to be used
                           // multipart/form-data is required as a Content-Type
                           // boundary needs to be correctly set in both header and body to process the request

sample body

--uBPJE!%vdZ*leTfePa%Rro&6
Content-Disposition: form-data; name="file"; filename="testfile2.txt"
Content-Type: application/octet-stream

<title>A post with "quotes"</title>Something.
--uBPJE!%vdZ*leTfePa%Rro&6--

response: empty

List Folders (Root)

action: /api2/v1/connectors/{connectorId}/folders
                           
                           // method GET needs to be used

response: JSON
{
   "lastChangedFiles": [],
   "rootFolder": true,
   "currentFolder": "/",
   "files": [
       {
           "size": {},
           "name": "Sample Folder",
           "encodedName": "2f416d6573746f20576562696e6172",
           "id": "id:AcSEvwTyTwkAAAAAAAAHHQ",
           "lastModified": {},
           "contentType": {},
           "directory": true,
           "selected": false
       }
    ],
    "encodedCurrentFolder": "2f"
 }

List Files in a Folder

action: /api2/v1/connectors/{connectorId}/folders/{encodedName}

                           // method GET needs to be used

response: JSON

{
   "lastChangedFiles": [],
   "rootFolder": false,
   "currentFolder": "/Sample Folder",
   "files": [
       {
           "size": 22522,
           "name": "Sample file.xlsx",
           "encodedName": "416d6573746f2d4d656d736f7572636520776562696e6172205126412e786c7378",
           "id": "id:AcSEvwTyTwkAAAAAAAAHHg",
           "lastModified": 1505817115000,
           "contentType": {},
           "directory": false,
           "selected": false
       }
    ],
    "encodedCurrentFolder": "2f416d6573746f20576562696e6172"
 }

Download from Online Repository

action: /api2/v1/connectors/{connectorId}/folders/{encodedName}/files/{encodedName}

                           // method GET needs to be used

response: binary