I've and node application mainApp
that running on CF space, in this node application im getting other application name
( that deployed in the same space) and I want to get from it the application guid , How I can do it ?
This is what I've tried ( I try to get all apps in this space and search for specific app from the guid
but I got http 401 - unauthorized
,
any idea how can I get from app that deployed to CF the app app guid (suppose I've the app name )
There is a better way to achieve this ?
getAllApps: () => {
return new Promise((resolve, reject) => {
rp({
uri: 'https://' + CF_API + '/v2/apps',
json: true
}).then((data) => {
"use strict";
console.log("apps data: " + data);
resolve(data);
});
})
You have to first get the access token and pass it in the header of the request you have in your question. See the example below that will get the application guid:
Check this:
With the httpclient API, you can get the app names from any language.