Download the SDF

Once your operation has finished successfully and you’ve extracted the resource name from the completed operation response, you are ready to download the .zip file containing your generated SDFs using the media.download method.

If using a client library, make sure to look at examples below as this method is implemented differently from library to library:

Java

// Extract download file resource name to use in download request
String downloadResourceName = operationResponse.getResponse()
    .get("resourceName").toString();

// Configure the Media.download request
Media.Download downloadRequest =
   service
       .media()
       .download(downloadResourceName);

// Create output stream for downloaded file
FileOutputStream outStream =
   new FileOutputStream(output-file);

// Download file
downloadRequest.executeMediaAndDownloadTo(outStream);

System.out.printf("File downloaded to %s\n", outputFile);

Python

# Extract download file resource name to use in download request
resourceName = operation["response"]["resourceName"]

# Configure the Media.download request
downloadRequest = service.media().download_media(
  resourceName=operation["response"]["resourceName"])

# Create output stream for downloaded file
outStream = io.FileIO(output-file, mode='wb')

# Make downloader object
downloader = googleHttp.MediaIoBaseDownload(outStream, downloadRequest)

# Download media file in chunks until finished
download_finished = False
while download_finished is False:
  _, download_finished = downloader.next_chunk()

print("File downloaded to %s" % output-file)

Once your file is downloaded and unzipped, your generated structured data files will be available to you. The generated files will have generic names identifying the SDF file type (example: “SDF-LineItems.csv”).

Skipped files

If data for a requested resource cannot be included in the corresponding structured data file, the .zip file downloaded might include a “Skipped” file (example: “SDF-LineItems-Skipped.csv”). This file will have a two-column structure, the first containing the IDs of the resources that couldn’t be included and the second containing the reason for their exclusion.

Resources may be skipped for many reasons, including being in an unsupported state or of an unsupported type. Avoid having resources skipped by using the most recent version of SDF.