Parent IDs in API

I noticed in the API response for tasks that the parentIds only returns 1 value in the array. Is there ever a time that it returns more than one? And if so, is 0 always the first or the one with the highest order to the root of the tree?

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos
8 Kommentare

I'm currently doing some experimenting with this. Here's what I've learned:

If you append the following to a "tasks" call, it will return all associated parent ids (eg: if a task or project exists within multiple folders, it will return an ID for each parent folder):

?fields=["parentIds"]

Parent Folder is defined as the closest folder(s) above a task, project, or subfolder. I have not figured out how to get IDs from any folders higher in the folder structure yet.

Curious to know this as well.  

 

 

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos
Avatar
Stephen

Hi Tim & Shane,

For this, you'll need to query individual folders to get the IDs of their parent IDs.

I reckon this might work better if you save the Folder tree information and update it every so often so you can reference the parent Folder local data and reduce the number of API calls.

 

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

Hey Stephen,

That's how I'm solving the problem at the moment. Saving those parent folders to a cached JSON file and then updating it as additional required folders are added. 

Has there been any discussion about creating a field where we can set what the authoritative or home folder ID? I know this would help slim down on the number of API calls I make to figure out a few other things.

Thanks!
Tim

1
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos
Avatar
Stephen

Hey Tim, sorry for the delay getting back. There are no plans for this at the moment, but I've shared your interest with the relevant team so this could change in the future. I'll post back here to let you know if there are any updates 👍

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

Thank you for your help Stephen. 

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

I'm noticing strange/undocumented behavior attempting to make a call for project or folders. I'm specifically trying to find the parent project of a folder by climbing the tree until I find a project.

When I call the method for projects, I get a column called parentIds without having to specify the parentIds field. There are valid parentIds in this column as expected: "https://www.wrike.com/api/v4/folders/XXXXXXXXXXXX/folders?project=true&descendants=true", 

However, when i call the method for folders, I do not get a column called parentIds: "https://www.wrike.com/api/v4/folders/XXXXXXXXXXXX/folders?descendants=true"

childIds do exist, but I'd like to climb up rather than down if possible. Am I doing something wrong?

 

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

Wow, and two seconds later I answer my own question. I had to set project=false in my request. When I do this I get parentIds as expected.

"https://www.wrike.com/api/v4/folders/IEACTBS3I4RFMNMK/folders?project=false&descendants=true"

I still think this is strange behavior. If you don't specify "true", shouldn't it default to the "false" behavior?

Edit:

OK, so if I specify false I lose my projects from the response (folders only). OK I get that. But why do I lose parentIds when I don't specify the project parameter?

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos
Avatar
Cansu

Hello Timothy Livingston, our Support team is in touch with you via email in relation to your question. Please let me know if I can help with anything else 🙋🏻‍♀️

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

Folllowing List for Post: Parent IDs in API
[this list is visible for admins and agents only]

Nach oben
Didn’t find what you were looking for? Write new post