6 Replies Latest reply on Mar 13, 2018 11:17 PM by Evanthika Amarasiri

    Bulk Export Activity API expected output

    Evanthika Amarasiri

      The question that I have is regarding the Get Export Activity File API functionality.

       

      Marketo API -  Bulk Export Activity API

      Resource -  Get Export Activity File  [GET /bulk/v1/activities/export/{exportId}/file.json]

       

      The implementation notes says ;

       

      Returns the file content of an export job. The export job must be in "Completed" state. Use Get Export Lead Job Status endpoint to retrieve status of export job.

       

      I found a job which is in Completed state and passed it on to this API but it did not return me any results. Could you kindly let me know;

      1. What actually should be returned as the response?

        Should it; 

      • Return a text response?
      • Return a file?
      • Return a JSON response?

       

      1. Right now I’m receiving a blank response with the following response headers and that’s it. Why isn't this scenario returning me any results and what sort of an invocation should I be doing in order to get a proper response?

       

      connection →keep-alive

      content-disposition →attachment; filename=file

      content-length →66

      content-type →text/csv

      date →Tue, 13 Mar 2018 00:42:37 GMT

      server →nginx

       

      Note: I’ve tried this out against the Marketo Sandbox environment where the REST API endpoint is https://743-YFC-765.mktorest.com/rest.

        • Re: Bulk Export Activity API expected output
          Sanford Whiteman

          The file endpoint is your CSV file (as should be clear from the headers). At 66 bytes it's probably just headers at best, though. Did you choose a date range in the future or far past by accident?

            • Re: Bulk Export Activity API expected output
              Evanthika Amarasiri

              Hi Sanford,

               

              Thanks a lot for the prompt response. So this is what I did.

               

              1. Get Paging token

              First I got a page token by calling the endpoint - /rest/v1/activities/pagingtoken.json

               

              2. Get Lead Activities

              Then I invoked the endpoint - /rest/v1/activities.json by passing the nextPageToken returned from the previous endpoint call along with the activityTypeIds.

              From this list, I was able to capture the dates that the activities have been created.

               

              3. Create Export Activity Job

              Endpoint called - /bulk/v1/activities/export/create.json

              Then I created a job for all the activityIds which I used to call the previous endpoint call along with the created date which I got by invoking the previous endpoint.

              I'm using the exportId which was generated for the job that I just created.

               

              4. Enqueue Export Activity Job

              Endpoint called - /bulk/v1/activities/export/${exportId}/enqueue.json

               

              5. Get Export Activity File

              Endpoint called - /bulk/v1/activities/export/${exportId}/file.json

               

              I waited until the job went from Created -> Enqueued -> Processing -> Completed

               

              Then called the endpoint and it returns only the following headers. The Body size in bytes value shows the size as 213 and looks like it's sending a blank file with new lines and that's the reason for the output I see.

              I tested this scenario with two different client tools and the results are the same. It's just returning a blank file with a bunch of new lines (\n).

               

              ****************************************************************************************************

              Thread Name: [Direct Invocation of Marketo API Backend] - Bulk Activity APIs 1-1

              Sample Start: 2018-03-14 13:07:14 AEDT

              Load time: 123

              Connect Time: 0

              Latency: 123

              Size in bytes: 401

              Headers size in bytes: 188

              Body size in bytes: 213

              Sample Count: 1

              Error Count: 0

              Data type ("text"|"bin"|""): text

              Response code: 200

              Response message: OK

               

              Response headers:

              HTTP/1.1 200 OK

              Server: nginx

              Date: Wed, 14 Mar 2018 02:07:14 GMT

              Content-Type: text/csv

              Content-Length: 213

              Connection: keep-alive

              Content-Disposition: attachment; filename=file

               

              HTTPSampleResult fields:

              ContentType: text/csv

              DataEncoding: null

              ****************************************************************************************************

               

              It would be great if you can verify what's causing this and whether you too can see the same behavior from your end as well?