REST API doesn't get primary app when using organization API-key


#1

Hi PlayCanvas Team,

We are currently developing a “cloud build” service utilizing the PlayCanvas RES API, which creates builds, puts in some custom meta tags in the index.html, auto-increments the version number and uploads it to a fileserver. But we ran into a problem:

When trying to fetch the project data via REST API, we get the following error:

404 {“error”: “Project does not have a primary app”}

The Request URL is going to: GET https://playcanvas.com/api/projects/PROJECT_ID/app

And the headers are: { “Authorization”=>“Bearer XXXXXX” }

The error only occurs when using the API-Key and a project ID of our organization.

The request is working fine if we use a ‘personal’ key on a personal project.

Any idea what’s causing this? Who is an appropriate contact on your side @will ?

ps.: Scenes, Build and Job endpoints are working fine

Any hints appreciated,
Rene & Team


#2

Are you sure your project has a primary app set? You need to click on the flag on the left of a build to make that the primary app of the project. See example screenshot below:

15


#3

Hi @vaios

thank you for your response. We do not have any ‘published’ builds of the apps, since they should not be publicly available on the Playcanvas website. Therefore we cannot mark a build as ‘primary app’.

But your input is quite insightful. We looked on the API documentation again and it seems that there is no endpoint for getting app information (like name, description, thumbnail, etc) for apps without a public build.

There are only 4 endpoints regarding the app:

Apps - Download app
[…] The request will start an export job […]

Apps - Get primary app
Gets the Primary App of a Project.

Apps - Get project apps
Lists all the published Apps of a Project.

Apps - Get app
Gets a published App by id.

So it seems there is no way to get information about an unpublished app.

Is this assumption correct?

Best,
Rene


#4

Not 100% sure what you are looking for when you get the primary app? If the idea is to keep the builds all off public access from PlayCanvas, Download App endpoint seems to be more appropriate to use to build the app and use your own description.

It sounds you are best keeping your own local/cloud copy of the details you are looking to get via Primary App.


#5

@yaustar We have our internal “cloudbuild” solution now set up, but we also want do display infos like the project thumbnail, description etc. there, without having the projects to be public.

So we’d like to get those infos, without having a “primary app” -> since this is only applicable for public projects afaik…


#6

@vaios is there a way to get project meta-data (e.g. description, thumbnail,…) with the API from private projects?


#7

Sure, what I was trying to say was that you could store the thumbnail and other meta data elsewhere (eg on the build server or internal network server) rather than part of the PlayCanvas project. It’s not the ideal solution as it would be nice to have everything in one place (PlayCanvas services) but it be workable?


#8

@yaustar thank you. Of course, that’s possible, but a rather redundant fallback solution :wink:

hopefully @vaios will have a better solution for this.


#9

@dexter_deluxe we do not have a route in the public API for getting project metadata at the moment.