Skip to content

Latest commit

 

History

History
127 lines (80 loc) · 8.75 KB

java-code-examples-for-the-windows-store-submission-api.md

File metadata and controls

127 lines (80 loc) · 8.75 KB
ms.assetid description title ms.date ms.topic keywords ms.localizationpriority
4920D262-B810-409E-BA3A-F68AADF1B1BC
Use the Java code examples in this section to learn more about using the Microsoft Store submission API.
Java sample - submissions for apps, add-ons, and flights
07/10/2017
article
windows 10, uwp, Microsoft Store submission API, code examples, java
medium

Java sample: submissions for apps, add-ons, and flights

This article provides Java code examples that demonstrate how to use the Microsoft Store submission API for these tasks:

You can review each example to learn more about the task it demonstrates, or you can build all the code examples in this article into a console application. For the complete code listing, see the code listing section at the end of this article.

Prerequisites

These examples use the following libraries:

Main program and imports

The following example shows the imports statements used by all of the code examples and implements a command line program that calls the other example methods.

:::code language="java" source="~/../snippets-windows/windows-uwp/monetize/StoreServicesExamples_Submission/java/MainExample.java" range="1-64":::

Obtain an Azure AD access token

The following example demonstrates how to obtain an Azure AD access token that you can use to call methods in the Microsoft Store submission API. After you obtain a token, you have 60 minutes to use this token in calls to the Microsoft Store submission API before the token expires. After the token expires, you can generate a new token.

:::code language="java" source="~/../snippets-windows/windows-uwp/monetize/StoreServicesExamples_Submission/java/CompleteExample.java" range="65-95":::

Create an add-on

The following example demonstrates how to create and then delete an add-on.

:::code language="java" source="~/../snippets-windows/windows-uwp/monetize/StoreServicesExamples_Submission/java/CompleteExample.java" range="310-345":::

Create a package flight

The following example demonstrates how to create and then delete a package flight.

:::code language="java" source="~/../snippets-windows/windows-uwp/monetize/StoreServicesExamples_Submission/java/CompleteExample.java" range="185-221":::

Create an app submission

The following example shows how to use several methods in the Microsoft Store submission API to create an app submission. To do this, the SubmitNewApplicationSubmission method creates a new submission as a clone of the last published submission, and then it updates and commits the cloned submission to Partner Center. Specifically, the SubmitNewApplicationSubmission method performs these tasks:

  1. To begin, the method gets data for the specified app.
  2. Next, it deletes the pending submission for the app, if one exists.
  3. It then creates a new submission for the app (the new submission is a copy of the last published submission).
  4. It changes some details for the new submission and upload a new package for the submission to Azure Blob Storage.
  5. Next, it updates and then commits the new submission to Partner Center.
  6. Finally, it periodically checks the status of the new submission until the submission is successfully committed.

:::code language="java" source="~/../snippets-windows/windows-uwp/monetize/StoreServicesExamples_Submission/java/CompleteExample.java" range="97-183":::

Create an add-on submission

The following example shows how to use several methods in the Microsoft Store submission API to create an add-on submission. To do this, the SubmitNewInAppProductSubmission method creates a new submission as a clone of the last published submission, and then updates and commits the cloned submission to Partner Center. Specifically, the SubmitNewInAppProductSubmission method performs these tasks:

  1. To begin, the method gets data for the specified add-on.
  2. Next, it deletes the pending submission for the add-on, if one exists.
  3. It then creates a new submission for the add-on (the new submission is a copy of the last published submission).
  4. It uploads a ZIP archive that contains icons for the submission to Azure Blob Storage.
  5. Next, it updates and then commits the new submission to Partner Center.
  6. Finally, it periodically checks the status of the new submission until the submission is successfully committed.

:::code language="java" source="~/../snippets-windows/windows-uwp/monetize/StoreServicesExamples_Submission/java/CompleteExample.java" range="347-431":::

Create a package flight submission

The following example shows how to use several methods in the Microsoft Store submission API to create a package flight submission. To do this, the SubmitNewFlightSubmission method creates a new submission as a clone of the last published submission, and then updates and commits the cloned submission to Partner Center. Specifically, the SubmitNewFlightSubmission method performs these tasks:

  1. To begin, the method gets data for the specified package flight.
  2. Next, it deletes the pending submission for the package flight, if one exists.
  3. It then creates a new submission for the package flight (the new submission is a copy of the last published submission).
  4. It uploads a new package for the submission to Azure Blob Storage.
  5. Next, it updates and then commits the new submission to PartnerCenter.
  6. Finally, it periodically checks the status of the new submission until the submission is successfully committed.

:::code language="java" source="~/../snippets-windows/windows-uwp/monetize/StoreServicesExamples_Submission/java/CompleteExample.java" range="223-308":::

Utility methods to upload submission files and handle request responses

The following utility methods demonstrate these tasks:

:::code language="java" source="~/../snippets-windows/windows-uwp/monetize/StoreServicesExamples_Submission/java/CompleteExample.java" range="433-490":::

Complete code listing

The following code listing contains all of the previous examples organized into one source file.

:::code language="java" source="~/../snippets-windows/windows-uwp/monetize/StoreServicesExamples_Submission/java/CompleteExample.java" range="1-491":::

Related topics