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 |
This article provides Java code examples that demonstrate how to use the Microsoft Store submission API for these tasks:
- Obtain an Azure AD access token
- Create an add-on
- Create a package flight
- Create an app submission
- Create an add-on submission
- Create a package flight submission
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.
These examples use the following libraries:
- Apache Commons Logging 1.2 (commons-logging-1.2.jar).
- Apache HttpComponents Core 4.4.5 and Apache HttpComponents Client 4.5.2 (httpcore-4.4.5.jar and httpclient-4.5.2.jar).
- JSR 353 JSON Processing API 1.0 and JSR 353 JSON Processing Default Provider API 1.0.4 (javax.json-api-1.0.jar and javax.json-1.0.4.jar).
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":::
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":::
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":::
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":::
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:
- To begin, the method gets data for the specified app.
- Next, it deletes the pending submission for the app, if one exists.
- It then creates a new submission for the app (the new submission is a copy of the last published submission).
- It changes some details for the new submission and upload a new package for the submission to Azure Blob Storage.
- Next, it updates and then commits the new submission to Partner Center.
- 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":::
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:
- To begin, the method gets data for the specified add-on.
- Next, it deletes the pending submission for the add-on, if one exists.
- It then creates a new submission for the add-on (the new submission is a copy of the last published submission).
- It uploads a ZIP archive that contains icons for the submission to Azure Blob Storage.
- Next, it updates and then commits the new submission to Partner Center.
- 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":::
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:
- To begin, the method gets data for the specified package flight.
- Next, it deletes the pending submission for the package flight, if one exists.
- It then creates a new submission for the package flight (the new submission is a copy of the last published submission).
- It uploads a new package for the submission to Azure Blob Storage.
- Next, it updates and then commits the new submission to PartnerCenter.
- 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":::
The following utility methods demonstrate these tasks:
- How to upload a ZIP archive containing new assets for an app or add-on submission to Azure Blob Storage. For more information about uploading a ZIP archive to Azure Blob Storage for app and add-on submissions, see the relevant instructions in Create an app submission, Create an add-on submission, and Create a package flight submission.
- How to handle request responses.
:::code language="java" source="~/../snippets-windows/windows-uwp/monetize/StoreServicesExamples_Submission/java/CompleteExample.java" range="433-490":::
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":::