App Store Connect API: Modifying Phased Release

I'm trying to automate the process of resuming, or completing a phased release using the "PATCH /v1/appStoreVersionPhasedReleases/{id}" endpoint.

When sending a request to update the PhasedReleaseState, I am seeing a 409 error that states:

An attribute value is not acceptable for the current resource state. You cannot change the state of a phased release in the current version state.

Source: {'pointer': '/data/attributes/pendingDeveloperRelease'}

Apparently PENDING_DEVELOPER_RELEASE is an invalid state.

Based on the "App and submission statuses" document, the PENDING_DEVELOPER_RELEASE state means:

Your app was approved, but you still need to release it for distribution on the App Store.

I'm a bit surprised that it would fail, when releasing the app for distribution is exactly what I'm trying to do by modifying the PhasedReleaseState to ACTIVE, or COMPLETE.

In addition, the "Release a version update in phases" document lists it as a valid state:

When you release a version update of your iOS, macOS, tvOS, or universal app, you can choose to release it to the App Store in stages. This option is available if you're submitting a version update and your app has one of the following app statuses;

 Prepare for Submission
 Waiting for Review
 In Review
 Waiting for Export Compliance
 Pending Developer Release
 Developer Rejected
 Rejected
 Metadata Rejected

Notably, some of the other states seem like they shouldn't be valid states to rollout an app (e.g. Rejected, Waiting for Review, etc.). So this makes me think that this document doesn't necessarily cover the list of valid states; more so, they tell you that you have the capability to perform a phased rollout for your app.

So, my question is, what are the valid app version states required for me to be able to successfully modify a phased rollout?

Any help, or pointers would be greatly appreciated. Thank you!

API Endpoint URL: https://developer.apple.com/documentation/appstoreconnectapi/modify_an_app_store_version_phased_release

App and submission statuses document:

https://developer.apple.com/help/app-store-connect/reference/app-and-submission-statuses

Release a version update in phases document: https://developer.apple.com/help/app-store-connect/update-your-app/release-a-version-update-in-phases

Accepted Answer

Reporting back after further testing.

When you use the Create an App Store Version Phased Release endpoint, it will set the phased release state to INACTIVE regardless of the desired PhasedReleaseState (e.g. ACTIVE) that you pass in to theAppStoreVersionPhasedReleaseCreateRequest body. I'm not sure why that endpoint details that you can specify a desired phased release state as it does nothing and is therefore misleading.

Anyway, I was previously trying to kick off a phased rollout by modifying an existing phased rollout from INACTIVE to ACTIVE. As you can see from the earlier post, it was failing because the app was in the PENDING_DEVELOPER_RELEASE state. I figured that the app would need to be in a READY_FOR_DISTRIBUTION state, but I was unsure about how I could trigger that state change. After reading some documentation elsewhere, I learned the following:

After your app is approved, the phased release will begin. If you set your app for manual release, the phased release will begin once you release the app in App Store Connect.

And this finally ticked the light bulb that I might need to use the Manually Release an App Store Approved Version of Your App endpoint in conjunction with the phased release.

I was initially hesitant to use that endpoint for obvious reasons (e.g. directly releasing an app 100%), but it'll behave differently depending on whether you had enabled a phase release for that release version in the first place. So, if you had enabled a phased release and it's in an INACTIVE state, hitting that "Manually Release" endpoint will initiate the rollout. After that, you can freely make adjustments/modifications to the phased rollout (e.g. pausing/resuming/completing). Otherwise, if you hadn't enabled a phase release, then that endpoint will release the app 100%.

App Store Connect API: Modifying Phased Release
 
 
Q