question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Google.Apis.Requests.RequestError : Track names in request path and request body must match

See original GitHub issue

Hello,

I have been using this nuget package for quite a while and since few days, I am not able to upload any APK. My code didn’t change, just the error appears after I updated the nuget package.

I got this exception :

Google.Apis.Requests.RequestError Track names in request path and request body must match. [400] Errors [ Message[Track names in request path and request body must match.] Location[ - ] Reason[badRequest] Domain[global]]

Here is my code :

public IUploadProgress UploadAPK(AppEdit edit, string packageName, string versionName, Stream file, string releaseNotes, string track)
{
           // Upload APK
            var uploadedApk = this.Service.Edits.Apks.Upload(
              packageName,
              edit.Id,
              file,
              "application/octet-stream");

            // Upload Callback
            uploadedApk.ResponseReceived += (apk) =>
            {
                if (apk == null)
                {
                    return;
                }

                // Get VersionCode
                List<long?> apkVersionCodes = new List<long?> { apk.VersionCode };

                // Create Realease Note
                LocalizedText note = new LocalizedText();
                note.Language = LANG_FR;
                note.Text = releaseNotes;

                var updatedTrack = this.Service.Edits.Tracks.Update(
                    new Track()
                    {
                        Releases = new List<TrackRelease>
                        {
                            new TrackRelease
                            {
                                Name = versionName,
                                VersionCodes = apkVersionCodes,
                                Status = "completed",
                                ReleaseNotes = new List<LocalizedText>() { note }
                            }
                        }
                    },
                    packageName,
                    edit.Id,
                    track);

                updatedTrack.Execute();

                var appEdit = this.Service.Edits.Commit(packageName, edit.Id).Execute();
            };

            var result = uploadedApk.Upload();
}

The error is showed when updatedTrack.Execute(); is called.

I have no idea where I can fix this.

Is it a bug or is anyone know how to fix this ?

Thanks for your help.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

3reactions
GrecoRom1commented, Mar 16, 2020

After looking for a solution, I tried something and it worked!

I just added to the Track object (the “body”) the string value of TrackValue and it worked :

TrackValue = track,

                var updatedTrack = this.Service.Edits.Tracks.Update(
                    new Track()
                    {
                        TrackValue = track,
                        Releases = new List<TrackRelease>
                        {                            
                            new TrackRelease
                            {
                                Name = versionName,
                                VersionCodes = apkVersionCodes,
                                Status = "completed",
                                ReleaseNotes = new List<LocalizedText>() { note }
                            }
                        }
                    },
                    packageName,
                    edit.Id,
                    track);

It could be nice to find an update notes when they update the API.

Anyway, the problem is solved, thanks all for your help.

1reaction
GrecoRom1commented, Mar 16, 2020

Thanks @GrecoRom1 that works for me as well, though I had to place the addition under new Track() instead of new List<TrackRelease> (typo I assume? Or would that be a pasto?)

You’re right, I updated my answer

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Track names in request path and request body must match ...
I am using google-api-python-client 1.7.11. I could not find anything about the error online. Has anyone here an idea? Update. Thanks to the ......
Read more >
Android Publisher: &quot;Track names in request path and ...
I'm having similar problems publishing with Codemagic Google Play publishing fails with "Track names in request path and request body must match", ...
Read more >
Error messages | Resource Manager Documentation
The API server cannot parse the request body. The API request is missing required information. The required information could be a parameter or...
Read more >
Resolve errors | Google Drive
Resolve a 5xx error​​ This can be caused by various issues, including a request's timing overlapping with another request or a request for...
Read more >
Scripted REST API example - script samples
A match on ALL of the terms in the phrase you typed. A match on ANY of the terms in the phrase you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found