2

I want to upload external data csv file to create a dataset in Salesforce Wave Analytics using External Data API but i cannot find any useful REST API for same. Can someone provide me links?

1 Answer 1

3

The Docs only show via partner WSDL .You can easily translate it to a REST API version .

Here are the steps you will need to do in REST API

1.Oauth and obtain access Token from Salesforce Instance

2.Create a row in InsightsExternalData object using rest api by making a http post request to below url

/services/data/v39.0/sobjects/InsightsExternalData 

The object structure is as below

{
 "Format": "Csv",
 "EdgemartAlias": "Test",
 "Operation": "Overwrite",
  "Action": "none",
  "MetadataJson" :base64encodeofmetaJSON
}

Kindly note if you have metadata.json then convert into base64 encoded format and add an additional field in the object as metadata

3.Note the Id from previous step and make a POST request to the below url

/services/data/v39.0/sobjects/InsightsExternalDataPart with below JSON

[{
    "DataFile": base64data,
    "InsightsExternalDataId": parentId,
    "PartNumber": 1
},
{
    "DataFile": base64data,
    "InsightsExternalDataId": parentId,
    "PartNumber": 2
},

{
    "DataFile": base64data,
    "InsightsExternalDataId": parentId,
    "PartNumber": 3
},

{
    "DataFile": base64data,
    "InsightsExternalDataId": parentId,
    "PartNumber": 4
  }
]

Note parentId is obtained from Step 2

4.Initiate the upload by updating the InsightsExternalData .Make a PATCH with below JSON

/services/data/v39.0/sobjects/InsightsExternalData/parentId

{
    "Action": "Process",
    "parentId": parentId
}

Note ParentId is obtained from step 2

8
  • Is there any documentation available on this?
    – Shreeya
    Commented May 9, 2017 at 12:34
  • @user44769 The docs show partner WSDL and all i did was use salesforce REST API doc and convert equivalent of it .developer.salesforce.com/page/REST_API .You can use workbench.developerforce.com/login.php to test .Thanks Commented May 9, 2017 at 12:36
  • I tried your way to use external data API, but in step 3 when i am trying to make a POST call using below data: { "DataFile": "base64data", "InsightsExternalDataId": "06V7F000000L0OdUAK", "PartNumber": 1, "metadata":"base64data" } i am getting an error as: [ { "message": "No such column 'metadata' on sobject of type InsightsExternalDataPart", "errorCode": "INVALID_FIELD" } ]
    – Shreeya
    Commented May 9, 2017 at 14:16
  • So i realized rest does not do mass .Can you try with individual records in step 3 and not whole array Commented May 9, 2017 at 14:18
  • Could you please revisit my previous comment? It was incomplete earlier. and Yes i've tried providing individual record.
    – Shreeya
    Commented May 9, 2017 at 14:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .