No download url available from completed Job

So for some reason, recently I havent been able to download sims through the rest api? The object that gets returned does not contain a download url for the app as it did previously. Is this a bug or an intentional deprecation?

EDIT: according to this I would expect there to be a download url to be present

AFAIK, that API endpoint never gave a download URL as it takes some time for the build to be ready. As mentioned on that page, that endpoint gives a ‘job’ id and you would use that to poll this endpoint to see when it is ready and returns a URL

So you’re technically correct, what Im trying to say is that a completed job isnt including a download url anymore? Is this a paid feature?

Odd that your output doesn’t have the status property from the screenshot

I just did a test with a free account and it looks fine on my end

{
  status: 'complete',
  messages: [],
  created_at: '2024-04-05T15:29:32.812000',
  modified_at: '2024-04-05T15:29:32.812000',
  data: {
    concatenate: true,
    branch_id: 'bcbf6e59-4db6-4c4c-97b7-f8527fbb7694',
    optimize_scene_format: false,
    minify: true,
    name: 'Model Viewer',
    sourcemaps: false,
    scenes: [ '1978551' ],
    download_url: 'someurl',
    engineVersion: '',
    project_id: 1206193,
    owner_id: 399703
  },
  id: 1813775

Are you checking the status property of the data when you poll the job endpoint?

From the docs: Jobs - Get job | PlayCanvas Developer Site

It looks like you are showing the data field json.

Are you checking the status property? If it’s still running, you need to poll again some time later and keep doing it till it’s complete. This repo does a lot of this work for you GitHub - playcanvas/playcanvas-rest-api-tools: A set of tools to use with the PlayCanvas REST API for common jobs such as downloading a build and archiving a project

So my status is error and the messages only includes “Could not export”. Anything else I can do to troubleshoot? Is my key just invalid?
image

Hmm, that is odd. I would try to see if you can download a build directly from the Editor.

In either case, I would reach out to the PlayCanvas team (@yak32 or support@playcanvas.com) as they would have more detailed logs

Hm, I’m getting this issue now. Seems fine if it’s a project that my username owns but not on a project where it’s on the PlayCanvas ORG and I’m a team member

ie This project I get an error like @Nicholas_Taylor2 https://playcanvas.com/project/785157/overview/flappy-bird-for-playable-fb-ad

But my fork is fine? https://playcanvas.com/project/1207041/overview/flappy-bird-for-playable-fb-ad

CC @Mark_Lundin

Weird, now it works :thinking:

@Nicholas_Taylor2 I’d try and download this manually via the editor to see if it works. Let me know if that’s still happening and I can take a look.

@yaustar is it still causing issues for you? Was it a export via the editor or the API download?

API download, I had errors to start with, tried a new API key, same issue.

Then forked the project and tried that, which was fine

Tried the original project 30 mins later and had no issue

I was able to successfully manually download from the editor. I am still unable to download via the API.

Are you using the playcanvas-rest-api tools? If so there was an update recently, so you’ll want to update your version

Nope, Im using the python requests library to hit the web endpoint.

Are you able to share the project @Nicholas_Taylor2 or add me to it, so I can take a look?

https://playcanvas.com/project/883802/overview/pepsin_degrade

Can you add me MARK-SNAP to the project?

1 Like

Hey @Nicholas_Taylor2, I just tried downloading your project from the terminal and it seemed to work fine.

Can you verify this works for you?

curl -H "Authorization: Bearer {ACCESS_TOKEN}" -H "Content-Type: application/json" -X POST -d '{"project_id": 883802, "scenes": [1338349], "name": "My App"}' "https://playcanvas.com/api/apps/download"

and then poll the job with the ID

curl -H "Authorization: Bearer {ACCESS_TOKEN}" "https://playcanvas.com/api/jobs/{JOB_ID}"

@Mark_Lundin

that did indeed work.

How often are you polling API to see if the job is done?

1 Like

Yep that’s a valid point, the download_url isn’t immediately available, although that wouldn’t explain the Could not export message