This article explains on how to upload SourceMaps by using the Controller UI and REST APIs.

Upload Source Maps in the Controller UI

  1. From the left-hand panel, click Configuration.
  2. Click ProGuard Mapping & NDK Symbol Files & Source Maps.
  3. From the Upload Missing ProGuard Mapping dialog:
    1. Enter the version name for the package. This is the versionName property specified in either the  AndroidManifest.xml file or the build.gradle file of the application for which this mapping file was generated.
    2. Click Choose File.
      The uploader expects a file with the .txt extension. The file is named mapping.txt.
    3. In the file browser, locate and select the mapping file and click Open.
    4. Click Upload.

Upload Source Maps with the REST API

The API uses HTTP basic authentication. The username is your Splunk AppDynamics EUM account name and the password is your EUM license key.

If you wish to disable this REST API and use the Controller API that uses the token-based upload, contact Cisco AppDynamics Support.

Send the Source Mapping file

Send the mapping file as a text file in the body of the PUT request to the following URL:


https://api.eum-appdynamics.com/v2/account/<MyAccountName>/<app-key>/<androidPackageName>/<version-string>/[Android/iOS]/jssource-mapping
BASH
https://fra-api.eum-appdynamics.com/v2/account/<MyAccountName>/<app-key>/<androidPackageName>/<version-string>/[Android/iOS]/jssource-mapping
BASH
https://syd-api.eum-appdynamics.com/v2/account/<MyAccountName>/<app-key>/<androidPackageName>/<version-string>/[Android/iOS]/jssource-mapping
BASH

See SaaS Domains and IP Ranges for more EUM server locations. 

These parameters are required:

  • MyAccountName: the URL-encoded version of your account name.
  • androidPackagename: the name of the Android package for which this mapping file was generated.
  • versionName: the string representation of the "version-string" property specified in either the AndroidManifest.xml file or the build.gradle file of the application for which this mapping file was generated. 

The request body contains the mapping file. You are required to add a Content-Type header, -H Content-Type:text/plain, and your account name and license key/password to the call. 

Sample Request and Response Using the REST API

This is a sample request and response using the REST API. 

Upload Request

The following example uses curl to send a Source Map file. You would use a similar command to send a DexGuard mapping file. The account name is "Example account" and the license key/password is "Example-License-Key-4e8ec2ae6cfe". The plus signs replace spaces in the account name when the account name is URL-encoded. The package name of the Android application is "com.appdynamics.android.ReactNativeEveryFeature". The mapping file corresponds to the version with versionName.

curl -v -H Content-Type:text/plain --upload-file "index.android.bundle.txt" --user Example+account:Example-License-Key-4e8ec2ae6cfe https://shadow-eum-api.appdynamics.com/v2/Example+account/SH-AAB-AAE-WNX/com.appdynamics.android.ReactNativeEveryFeature/1/Android/jssource-mapping
BASH
curl -v -H Content-Type:text/plain --upload-file main.jsbundle.map" --user Example+account:Example-License-Key-4e8ec2ae6cfe https://shadow-eum-api.eum-appdynamics.com/v2/account/Example+account/SH-AAB-AAE-WNX/com.appdynamics.ios.ReactNativeEveryFeature/1.0/iOS/jssource-mapping
CODE


The API uses HTTP basic authentication. The username is your Splunk AppDynamics EUM account name and the password is your EUM license key.

Upload Request

The following example uses curl to send a Source Mapping file. You would use a similar command to send a DexGuard mapping file. The account name is "Example account" and the license key/password is "Example-License-Key-4e8ec2ae6cfe". The plus signs replace spaces in the account name when the account name is URL-encoded. The package name of the Android application is "com.example.networklogger". The mapping file corresponds to the version with versionName.

Upload Response 

The successful output of the example request looks like this:

* About to connect() to api.eum-appdynamics.com port 443 (#0)
*   Trying ::1...
* connected
* Connected to api.eum-appdynamics.com  (::1) port 443 (#0)
* Server auth using Basic with user 'Example+account'
> PUT /v2/account/Example+account/com.example.networklogger/1/jssource-mapping HTTP/1.1
> Authorization: Basic SW50ZXJuYWwrdGVzdCthY2NvdW50OlRlc3RBY2N0LTFlMzktNDVkMy05MzAzLTRlOGVjMmFlNmNmZQ==
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8y zlib/1.2.5
> Host: api.eum-appdynamics.com
> Accept: */*
> Content-Length: 4
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Content-Length: 0
< Server: Jetty(8.1.4.v20120524)
<
* Connection #0 to host api.eum-appdynamics.com left intact
* Closing connection #0
BASH
* About to connect() to fra-api.eum-appdynamics.com port 443 (#0)
*   Trying ::1...
* connected
* Connected to fra-api.eum-appdynamics.com  (::1) port 443 (#0)
* Server auth using Basic with user 'Example+account'
> PUT /v2/account/Example+account/com.example.networklogger/1/jssource-mapping HTTP/1.1
> Authorization: Basic SW50ZXJuYWwrdGVzdCthY2NvdW50OlRlc3RBY2N0LTFlMzktNDVkMy05MzAzLTRlOGVjMmFlNmNmZQ==
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8y zlib/1.2.5
> Host: fra-api.eum-appdynamics.com
> Accept: */*
> Content-Length: 4
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Content-Length: 0
< Server: Jetty(8.1.4.v20120524)
<
* Connection #0 to host fra-api.eum-appdynamics.com left intact
* Closing connection #0
BASH
* About to connect() to syd-api.eum-appdynamics.com port 443 (#0)
*   Trying ::1...
* connected
* Connected to syd.eum-appdynamics.com  (::1) port 443 (#0)
* Server auth using Basic with user 'Example+account'
> PUT /v2/account/Example+account/com.example.networklogger/1/jssource-mapping HTTP/1.1
> Authorization: Basic SW50ZXJuYWwrdGVzdCthY2NvdW50OlRlc3RBY2N0LTFlMzktNDVkMy05MzAzLTRlOGVjMmFlNmNmZQ==
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8y zlib/1.2.5
> Host: syd-api.eum-appdynamics.com
> Accept: */*
> Content-Length: 4
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Content-Length: 0
< Server: Jetty(8.1.4.v20120524)
<
* Connection #0 to host syd-api.eum-appdynamics.com left intact
* Closing connection #0
BASH


Use the Token to Upload Source Maps with the REST API 

Ensure that the following property is enabled to use the token-based upload:

MAPPING_FILE_UPLOAD_API_DISABLED: True
CODE


Complete the following steps to upload the Source Map file:

  1. Generate a token to upload the file:
    curl -L -X GET -u <username>@<accountName>:<password> '<controller base url>/controller/restui/mobileRUMConfig/fileUploadToken'
    CODE
  2. Obtain the application ID:
    curl -L -X GET -u <username>@<accountName>:<password> '<controller base url>/controller/restui/mobileRUMConfig/getApplicationId/<App key>'
    CODE
  3. Upload the Source Map file:
    curl -L -X POST -u <username>@<accountName>:<password> '<controller base url>/controller/restui/mobileRUMConfig/uploadSourceMappingFile/<applicationID>?token=<token>' -F 'fileData=@"<source map file PATH"' -F 'mobileAppName="<app name>"' -F 'versionName="<version-string>"' -F 'platform="<Platform>"'
    CODE