Riskforce API File Uploads
File uploads will be sent individually with a maximum file size of 4.3MB. The following file types are acceptable: ‘pdf’, ‘doc’, ‘docx’, ‘xls’, ‘xlsx’, ‘jpeg’, ‘jpg’, ‘txt’. The file uploads will require two (2) separate API requests, with the second request differing for Opportunities and Cases:
Request 1: the initial call will be utilized to retrieve a Session Id. Below is the data needed:
Endpoint(s):
- <https://test.salesforce.com/services/oauth2/token> (Sandbox)
- <https://login.salesforce.com/services/oauth2/token> (Production)
Header: Content-Type = application/x-www-form-urlencoded
Request Format: grant_type=password&client_id=CLIENT_ID &client_secret= CLIENT_SECRET &username=SF_USERNAME&password=SF_PASSWORD
The following values will be provided by Profitstars for each environment:
CLIENT_ID
CLIENT_SECRET
SF_USERNAME
SF_PASSWORD
Request (Sandbox):
Please note: the below is the exact request (you can copy & paste) for Sandbox testing:
grant_type=password&client_id=3MVG9XmM8CUVepGZDLbd5VPlTk_R48QTyT7zqV361_QUn
cXNi9eO6q67yeMi7vnQaQEv9v6gdhCKsoQAHnTLO&client_secret=1683B07D55B28ADCF603
F0D34E9147B87FACC30E0BDBF86A96369B1862255672&username=produploads@jackhenr
y.com.stage&password=vCXty5rr7BfejvSp1uTcrnpHXZl2zv2UrLuN24
Example Response (access_token value (Session Id) below will be used for Request 2):
{
"access_token": "00DM0000000Fti1!AQMAQMChe0En.Oh_.pher1Ij7an0Tmv_2ofyWwz8sEybAh_iOc8Z4FM223aLYBbbWjDpnZeBwvsfUbdML1sn8_pRGSP4yLb",
"instance_url": "https://profitstars--Stage.cs7.my.salesforce.com",
"id": "https://test.salesforce.com/id/00DM0000000Fti1MAC/005M0000007TsVoIAK",
"token_type": "Bearer",
"issued_at": "1564767107350",
"signature": "nwxKGlewhhETuvcUHtHES+pfy5khLWiOL9eo67m9x1A="
}
Request 2: the second call will be utilized to upload the document(s) to the desired Opportunity or Case. Below is the data needed:
Opportunities:
Endpoint(s):
- [<https://cs7.salesforce.com/services/apexrest/Opportunity>] (Sandbox)
- [<https://na59.salesforce.com/services/apexrest/Opportunity>] (Production)
Authorization: “OAuth ” + sessionId
Content-Type: application/json
Accept: application/json
Request Format:
{
"transNumber" : "00000000",
"key" : "testkey",
"filename" : "testfilename.pdf",
"filecontent" : "testfilecontent”
}
transNumber = transaction number of the Opportunity.
key = key to indicate which file on the Opportunity the file corresponds to (i.e. Voided Check).
filename = the name of the file being uploaded. Include full file name including file extension
(i.e. “testfilename.pdf”).
filecontent = content of file.
PLEASE NOTE: the content will need to be encoded in base 64.
Example Request:
{
"transNumber": "00001111",
"key": "Voided Check",
"filename": "testfilename.06.04.txt",
"filecontent": "dGVzdCBmcm9tIGV4dGVybmFsIHN5c3RlbSBKSCBURVNUIDIwMTktMDYtMDTk="
}
Example Response:
"File 'testfilename.06.04.txt' added successfully to opportunity ABC Company, Inc."
Cases:
Endpoint(s):
- https://cs7.salesforce.com/services/apexrest/Case (Sandbox)
- <https://na59.salesforce.com/services/apexrest/Case> (Production)
Authorization: “OAuth ” + sessionId
Content-Type: application/json
Accept: application/json
Request Format:
{
"caseNumber" : "00000000",
"key" : "testkey",
"filename" : "testfilename.pdf",
"filecontent" : "testfilecontent”
}
caseNumber = number of the Case.
key = key to indicate which file on the Case the file corresponds to (i.e. Voided Check).
filename = the name of the file being uploaded. Include full file name including file extension
(i.e. “testfilename.pdf”).
filecontent = content of file.
PLEASE NOTE: the content will need to be encoded in base 64.
Example Request:
{
"caseNumber": "00001111",
"key": "Voided Check",
"filename": "testfilename.06.04.txt",
"filecontent": "dGVzdCBmcm9tIGV4dGVybmFsIHN5c3RlbSBKSCBURVNUIDIwMTktMDYtMDTk="
}
Example Response:
"File 'testfilename.06.04.txt' added successfully to case 00001111"
Production Request 1 to be provided upon request and completion of Sandbox testing.