2022

Page tree
Skip to end of metadata
Go to start of metadata

Checklist 

There are only few API Methods that are exposed in this release. We will be adding more methods in the upcoming releases. 

  1. User should have the release of 4.2.9 or later .
  2. A valid Salesforce and FTP credentials. 

SalesForceToFileSystem API

The SalesForceToFileSystem method is the actual API call used to invoke the API Method so that the file from previous Salesforce objects gets downloaded to the assigned file path of the FTP server. This will enable an unregistered user to access this API method.

Click on SFToFTP url  to try out the method 


Title

SalesForceToFileSystem API

URL


The URL structure (path only, no root url) is v1/sftofilesystem.

  1. v1 changes whenever the hosted environment of APIServer changes.
  2. The user can access the relevant method call by entering appropriate version before the method's name.


Method


The request type is POST.


URL Params


N/A


Data Params


As the SalesForceToFileSystem is a post request, the body payload should be in the following format:

{
"sfConfig":

{

"username": "string",
"password": "string",
"securityToken": "string",
"sessionId": "string",
"endpointURL": "string"
},
"targets": [

{

"host": "string",
"port": "string",
"filesystemType": "string",
"username": "string",
"password": "string",
"folder": "string",
"bucket": "string",
"targetFileName": "string",
"region": "string"
}

],
"queryToTheAttachment": "string"
}

Example

As the SalesForceToFileSystem is a post request, The body payload should be in format below:

{
"sfConfig": {
"username": "john@avankia.com",
"password": "123456",
"securityToken": "fbEw74CxeC8kcxLK2zUnAlcp3",
"sessionId": "",
"endpointURL": "https://ap2.salesforce.com/services/Soap/u/39.0"
},
"targets": [ {
"host": "account.avankia.com",
"port": "21",
"filesystemType": "ftp",
"username": "anil.b@avankia.com",
"password": "123456",
"folder": "testFiles",
"bucket": "string",
"targetFileName": ""
"region": ""
} ],
"queryToTheAttachment": "select Name,Body from attachment where id = '00P2800000lT3mq'"
}


Success Response


The status code on success response should be 200.


Example

Code : 200

Response Body :

[
{
"id": "testFiles/Sampledata.txt",
"newid": "testFiles/Sampledata.txt",
"success": true,
"errors": [null]
}
]


Error Response


Endpoint may fail in many ways. Below are some of the known error response code and response body.

Code 401 : Unauthorized access

Code 403 : Forbidden error

Example

Code : 401

Response Body :

[
{
"success": false,
"errors : [ "INVALID_LOGIN: Invalid username, password, security token; or user locked out."]
}
]



Sample Call


Below is a sample call from the endpoint. This would make the API call more predictable to the reader.


curl -X POST --header 'Content-Type: application/json' --header 'Accept: text/html' -d '

{


"sfConfig":{
"username":"john@avankia.com",
"password":"@test123",
"securityToken":"fbEw74CxeC8kcxLK2zUnAlcp3",
"sessionId":"https://ap2.salesforce.com/services/Soap/u/39.0",
"endpointURL":"string"},
"targets":[{
"host":"account.avankia.com","port":"21",
"filesystemType":"ftp",
"username":"anil.b@avankia.com",
"password":"123456",
"folder":"testFiles",
"bucket":"",
"targetFileName":"",
"region":""
}],
"queryToTheAttachment":"select Name,Body from attachment where id = '00P2800000lT3mq"


}'


'https://api.mydbsync.com:443/api/appcode/v1/sftofilesystem/upsertFile'





  • No labels