use the PUT API to update Parent relationship

42 views
Skip to first unread message

Jon Ku

unread,
Jul 23, 2024, 8:41:06 PMJul 23
to dotCMS User Group
Hello, I am working from the docs to use the API to manage relationships directly on a Taxonomy contentlet, to add multiple parents programmatically. Ideally I would send source and target taxonomy identifiers, query the source to get current parents, add the new parent to the list and update via PUT. The docs imply that I can set multiple relationships by passing the identifiers comma-delimited.

Update an Employees Passing Employee Identifier and Identifier of Office Location to the Location Field
https://www.dotcms.com/docs/latest/save-content-using-workflows

Here's my code and response, running Curl on Mac OS. Can you point out my error, thanks.

- Jon


Curl
--header 'Content-Type: application/json' -d '{
"contentlet": {
identifier:"a070e4d815d9f620101c5f3a1fe5d3f0",
contentType:"Taxonomy",
parent:"#2fd0c98e-9b5e-4d63-bd63-06938af85c40"
}
}' response
{"message":"Content not found"}zsh: command not found: --header Existing contentlets by title, identifier and inode Billing
a070e4d815d9f620101c5f3a1fe5d3f0
#799c4bd9-1f02-4755-aab6-0c1ebdf29456
...
Koodo
a3a6fb489ef514f11fe1c7111bc1064c
#2fd0c98e-9b5e-4d63-bd63-06938af85c40

Mark Pitely

unread,
Jul 24, 2024, 9:47:47 AMJul 24
to dot...@googlegroups.com
There's a pound/hash sign in front of your parent identifier that does not belong.
parent:"#2fd0c98e-9b5e-4d63-bd63-06938af85c40"
should be
parent:"2fd0c98e-9b5e-4d63-bd63-06938af85c40"  
M

--
http://www.dotcms.com - Open Source headless/hybrid CMS
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/80780ce6-df34-4172-812a-2cef7f7532b0n%40googlegroups.com.

Jon Ku

unread,
Jul 24, 2024, 11:14:27 AMJul 24
to dotCMS User Group
Thanks for the close read!

In this case I was trying to use the parent's inode, since the identifier doesn't work either.

- Jon

Jon Ku

unread,
Jul 24, 2024, 11:27:00 AMJul 24
to dotCMS User Group
Oops! In fact the pound sign was a typo in the inode, but this still doesn't work. Looks like the API can't find the source taxonomy, although its inode is specified on the URL.

- Jon

Jon Ku

unread,
Jul 24, 2024, 1:42:38 PMJul 24
to dotCMS User Group
Hey Mark, you are spot on with the catch about the pound sign. I have the inode in the URL and it was wrong too ... I'm going to put in a ticket to finish this off, it's really close but now getting a message that "only the working version can be published."

Once I get this solved we are well on our way to completing this tree-based UI for managing taxonomy relationships.

- Jon
Reply all
Reply to author
Forward
0 new messages