<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Some problems with API - PUT user in groups]]></title><description><![CDATA[<p dir="auto">Why 2 different ways for the same thing?</p>
<ol>
<li><a href="https://my.example.com/api/v1/groups/%7BgroupId%7D/members" target="_blank" rel="noopener noreferrer nofollow ugc">https://my.example.com/api/v1/groups/{groupId}/members</a><br />
2.<a href="https://my.example.com/api/v1/users/%7BuserId%7D/groups" target="_blank" rel="noopener noreferrer nofollow ugc">https://my.example.com/api/v1/users/{userId}/groups</a></li>
</ol>
<p dir="auto">..but both are not working. I tried all: normal arrays, nested arrays, array with 2 members. Error messages:</p>
<ol>
<li>"missing or invalid userIds fields"</li>
<li>"API call requires a groups array."</li>
</ol>
<p dir="auto">Example:<br />
{<br />
"groupIds": [<br />
"gidXXXXXXXXX"<br />
]<br />
}</p>
<p dir="auto">Maybe the API documentation is wrong?</p>
]]></description><link>https://forum.cloudron.io/topic/8160/some-problems-with-api-put-user-in-groups</link><generator>RSS for Node</generator><lastBuildDate>Wed, 11 Mar 2026 16:50:43 GMT</lastBuildDate><atom:link href="https://forum.cloudron.io/topic/8160.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 Dec 2022 10:03:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Some problems with API - PUT user in groups on Thu, 08 Dec 2022 14:46:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/girish" aria-label="Profile: girish">@<bdi>girish</bdi></a> said in <a href="/post/57860">Some problems with API - PUT user in groups</a>:</p>
<blockquote>
<p dir="auto">{"groupIds":["gid-3e96c503-d30f-4db8-aa37-ecaf98fa33fa"]}</p>
</blockquote>
<p dir="auto">Thank you, works fine.  It was a spelling-error in the "content-type" .</p>
]]></description><link>https://forum.cloudron.io/post/57884</link><guid isPermaLink="true">https://forum.cloudron.io/post/57884</guid><dc:creator><![CDATA[brainsailer]]></dc:creator><pubDate>Thu, 08 Dec 2022 14:46:53 GMT</pubDate></item><item><title><![CDATA[Reply to Some problems with API - PUT user in groups on Thu, 08 Dec 2022 09:31:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/brainsailer" aria-label="Profile: brainsailer">@<bdi>brainsailer</bdi></a> said in <a href="/post/57785">Some problems with API - PUT user in groups</a>:</p>
<blockquote>
<p dir="auto">"missing or invalid userIds fields"<br />
"API call requires a groups array."</p>
</blockquote>
<p dir="auto">BTW, these both seems like you are not setting the content-type as json when sending the request.</p>
]]></description><link>https://forum.cloudron.io/post/57863</link><guid isPermaLink="true">https://forum.cloudron.io/post/57863</guid><dc:creator><![CDATA[girish]]></dc:creator><pubDate>Thu, 08 Dec 2022 09:31:43 GMT</pubDate></item><item><title><![CDATA[Reply to Some problems with API - PUT user in groups on Thu, 08 Dec 2022 09:28:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/brainsailer" aria-label="Profile: brainsailer">@<bdi>brainsailer</bdi></a> said in <a href="/post/57785">Some problems with API - PUT user in groups</a>:</p>
<blockquote>
<p dir="auto">Why 2 different ways for the same thing?</p>
</blockquote>
<p dir="auto">Initially, there was only a way to assign members to groups. So, we had the simple <code>/api/v1/groups/{groupId}/members</code>. Later, people wanted to add a specific user to one or more groups i.e via the groups dropdown in the user edit dialog. Accomplishing this with the <code>/api/v1/groups/{groupId}/members</code> route is complicated. We have to go into each group, get members of each group and set the members of each group. One has to also do this for the groups in which the user is removed.</p>
<p dir="auto">So, to simplify the frontend (and also for correctness since this has to be done in a single transaction), we added a new route <code>/api/v1/users/{userId}/groups</code>.</p>
]]></description><link>https://forum.cloudron.io/post/57862</link><guid isPermaLink="true">https://forum.cloudron.io/post/57862</guid><dc:creator><![CDATA[girish]]></dc:creator><pubDate>Thu, 08 Dec 2022 09:28:36 GMT</pubDate></item><item><title><![CDATA[Reply to Some problems with API - PUT user in groups on Thu, 08 Dec 2022 09:20:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/brainsailer" aria-label="Profile: brainsailer">@<bdi>brainsailer</bdi></a> Try something like this:</p>
<pre><code>curl 'https://my.example.com/api/v1/groups/{groupId}/members' -X PUT -H 'Authorization: Bearer xx' -H 'Content-Type: application/json' -d '{"userIds":["uid-19953f08-c020-46a1-84ef-75e0274e6c1e"]}'
</code></pre>
<p dir="auto">Alternately:</p>
<pre><code>curl 'https://my.smartserver.io/api/v1/users/{userId}/groups' -X PUT -H 'Authorization: Bearer xxxx' -H 'Content-Type: application/json' -d '{"groupIds":["gid-3e96c503-d30f-4db8-aa37-ecaf98fa33fa"]}'
</code></pre>
]]></description><link>https://forum.cloudron.io/post/57860</link><guid isPermaLink="true">https://forum.cloudron.io/post/57860</guid><dc:creator><![CDATA[girish]]></dc:creator><pubDate>Thu, 08 Dec 2022 09:20:23 GMT</pubDate></item></channel></rss>