Apex REST Callout to Asana Api

Hi all,

I need help calling Asana’s API from Salesforce. I have no coding experience and am hitting a wall. I need to write a REST Callout that queries Asana Projects and retrieves the Project Id based on the Project Name containing ‘XYZ’.

For context, I have a Salesforce Flow that creates an Asana project based on the Opportunity Products ordered. After the project is created, the Flow pauses for 1 minute, which gives Asana enough time to create the project. I then need to write a REST Callout that retrieves this projects Id, so I can create Asana tasks and relate them to the newly created project.

Here is my code so far:
public class GetAsanaProjectId {
// Pass in the endpoint to be used using the string url
public String getAsanaProjectIdResponse(https://app.asana.com/api/1.0/projects) {

    // Instantiate a new http object
    Http h = new Http();
 
     // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
    HttpRequest req = new HttpRequest();
    req.setEndpoint(https://app.asana.com/api/1.0/users/me);
    req.setMethod('GET');
 
    // Send the request, and return a response
    HttpResponse res = h.send(req);
    return res.getBody();
  }
}

I need to query project ids
have Salesforce creating Asana projects based on a template. The first three tasks from the template need to be assigned to the Salesforce Opportunity Owner, which varies.

What I am trying to do is retrieve Asana project ids that meet a criteria.


What am I missing?

Thank you for any assistance!

Hi @Dejan_Milo,
Sorry for the late response. I hope my answer is still relevant.
To search for a project which matches a specific name, what I usually do is get all projects in the workspace and loop through them with if statement. I hope this helps!