How do i get only the project names from a workspace?

Hello, i tried to fetch just the project names from a workspace but its not working for me like i expected

const asana = require('asana');

const client = asana.Client.create().useAccessToken('TOKEN');

client.projects.getProjectsForWorkspace(workspaceid, {param: "value", param: "value", opt_pretty: true})
    .then((result) => {
        console.log(result);
    });

Errors im getting

Unhandled rejection Error: Not Found
    at NotFound.AsanaError (testt/node_modules/asana/lib/errors/error.js:4:11)
    at new NotFound (testt/node_modules/asana/lib/errors/not_found.js:5:14)
    at Request._callback (testt/node_modules/asana/lib/dispatcher.js:263:23)
    at Request.self.callback (testt/node_modules/request/request.js:185:22)
    at Request.emit (node:events:390:28)
    at Request.<anonymous> (testt/node_modules/request/request.js:1154:10)
    at Request.emit (node:events:390:28)
    at IncomingMessage.<anonymous> (testt/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (node:events:509:28)
    at IncomingMessage.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Hey @ambforumleader can anyone help @Muhammed_Shabeer with this question?

Thanks, Rashad

3 Likes

i fixed the error my bad with the gid, but how do i select only the name from that json output?

You can use opt_fields to ask for specific fields to be returned, check out the docs for examples.

5 Likes