How to get Download App via REST API

Hello community

I have followed the instructions here https://developer.playcanvas.com/en/user-manual/api/app-download/

my code

var request = require('request');
function callRequest(postData){
	postData = {
		project_id: MY_PROJECT ID,
		name: "MY GAME",
		scenes: [ID1, ID2],
		scripts_concatenate : true,
		version : '1.0'
	}
	
	var clientServerOptions = {
		uri: 'https://playcanvas.com/api/apps/download',
		body: JSON.stringify(postData),
		method: 'POST',
		headers: {
			'Content-Type': 'application/json',
			'Authorization': 'Bearer MY_TOKEN',
		}
	};
	
	request(clientServerOptions, function (error, response) {
		console.log(error,response.body);
		return;
	});
}

callRequest();

The result
Screenshot_7

The status always returns as running,

The question is when does it change status to completed and when do I get the download_url parameter

Can someone give me advice?

Thanks!

Hi @hoanguyen,

Haven’t tried it myself but from the docs I can see that you may have to poll the job with its id until it gets completed:

Description

This will allow you to download an app which you can self host on your own server. The request will start an export job and the job details will be returned in the response. You can poll the job by id until its status is either ‘complete’ or ‘error’. When the job is done, it’s data will contain a URL to download the exported app.

Here how is how you get the status of a job running:

https://developer.playcanvas.com/en/user-manual/api/job-get/

1 Like

Thank you

Is this the job ID?

Yes, exactly, does it return anything meaningful when running the Get job API?