How to identify which Apps are Guest Apps when using the Get Apps API

What I'm trying to do

I'm having an issue with Get Apps API.
What I want to do is get info of all apps in my domain.
Then I want to use Get App Admin Notes API to all Apps, so I can get info of Apps that don't have Notes set.

Issue

The URL of Get App Admin Notes is different for normal apps and guest apps.
Get Apps API returns all app info but it does not state if app is guest space app or not.
For each app I don't know if I should be using the normal endpoint or guest endpoint.

Question

Is there any way to tell if retrieved app is guest app, when using Get Apps API?

Hi @zebra_taxi

Based on the Get Apps API response, there does not appear to be a property that directly indicates whether an app belongs to a Guest Space.

However, the Get Apps API returns the spaceId for an app that belongs to a Space, so one approach is to use that spaceId with the Get Space API:

/k/v1/space.json

If the spaceId belongs to a regular Space, the request should succeed.

If it belongs to a Guest Space, the request will fail with an error indicating that /guest/{Guest Space ID}/ needs to be included in the API endpoint. For example, in my test I received the GAIA_IL25 error when using the regular Get Space endpoint with a Guest Space ID.

You can use this behavior to determine whether the spaceId belongs to a regular Space or Guest Space, and then use the appropriate endpoint for Get App Admin Notes:

Regular app:
/k/v1/app/adminNotes.json

Guest Space app:
/k/guest/{SpaceID}/v1/app/adminNotes.json

I tested this with both a regular Space and a Guest Space and was able to distinguish them using this approach.

I hope this helps.

Hi Chris

Thank you for your reply.

I guess I need to depend my code on error handling if I want to do this.
It is not a good way to code but if that is only solution I have no choice.