• OurPcGeek
  • Posts
  • How to Test Data Source Uploads via API 1.4 Using Postman

How to Test Data Source Uploads via API 1.4 Using Postman

Overview

This guide explores how to test the behavior of FTP data sources when data is uploaded through API 1.4 using Postman. Follow the step-by-step instructions to create a data source, upload data, and verify the result.

Step 1: Create a Data Source in Analytics UI

  1. Log in to Adobe Analytics SC 15.

  2. Navigate to Admin → Data Sources.

  3. Create a new Transaction ID Data Source.

Step 2: Configure the API Upload in Postman

Endpoint:

Use the following API endpoint to upload data:

https://api.omniture.com/admin/1.4/rest/?method=DataSources.UploadData

Step 2.1: Pre-request Script

In Postman, add the following script in the Pre-request Script section to generate the X-WSSE header dynamically.

var uuid = function() {};
uuid.v4 = function() {
    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
        var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
        return v.toString(16);
    });
};

var WSSE = function(username, secret) {
    this.username = username;
    this.secret = secret;
};

WSSE.prototype.getHeader = function() {
    var nonce = uuid.v4();
    var created = new Date().toISOString();
    var hashString = nonce + created + this.secret;
    var digest = CryptoJS.SHA256(hashString).toString(CryptoJS.enc.Base64);
    var b64nonce = CryptoJS.enc.Latin1.parse(nonce).toString(CryptoJS.enc.Base64);
    var header = "UsernameToken";
    header += " Username=\"" + this.username + "\",";
    header += " PasswordDigest=\"" + digest + "\",";
    header += " Nonce=\"" + b64nonce + "\",";
    header += " Created=\"" + created + "\",";
    header += " Algorithm=\"SHA256\"";
    return { 'X-WSSE': header };
};

var wsse = new WSSE('shared secret', 'password');
postman.setEnvironmentVariable("x-wsse", wsse.getHeader()['X-WSSE']);

Step 2.2: Request Body

Use the following JSON structure in the Body section (raw, JSON format):

{
  "columns": ["Date", "Product", "Orders", "transactionID"],
  "dataSourceID": "2",
  "jobName": "Product returned",
  "reportSuiteID": "lscsgeekourpc",
  "rows": [
    [
      "01/11/2019/06/00/00",
      "Shirt",
      "1",
      "1235"
    ]
  ]
}

Step 2.3: Headers

Set the X-WSSE header in the request:

  • Key: X-WSSE

  • Value: {Postman Environment Variable: x-wsse}

Step 3: Results Verification

  1. Upon successful upload, a SOAP folder is created in the data source's FTP location. This folder contains the uploaded data.

  2. Ensure the data size does not exceed 50 MB; otherwise, processing will pause until reduced below this limit.

  3. Avoid uploading more than 90 days of data per day to minimize delays in generating reports.

References

Notes

  • Always grab the Data Source ID from the URL after creating the data source in the UI.

  • For smooth processing, test small data batches before large-scale uploads.

By following these steps, you can efficiently test data uploads via API 1.4 using Postman while ensuring compliance with best practices.

Reply

or to participate.