1

I'm looking for the most efficient way to add a large number of members to a community via the API.

I can see in the community admin interface that it is possible to import a CSV of member email addresses, is there an equivalent method in the API?

I've tried just posting a feed of member entries to the standard community members endpoint, but I get a 400 response back with the message: Invalid member entry. This same endpoint works fine if I send the same entries individually.

I am posting to: /communities/service/atom/community/members?communityUuid=xxx

Ademund
  • 66
  • 5

1 Answers1

0

are you sending application/atom+xml or application/atomcat+xml as the Content-Type header?

Perhaps try this model .... ... updated to include xmlns in the entry feed

<feed>  <entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<title type="text">Amy Jones2</title>
<id>http://communities.ibm.com:2006/service/atom/community/members?communityUuid=2e68aa77-216c-4029-bedf-57d513abbaba&amp;email=ajones2@janet.iris.com</id>
<summary type="text">Amy Jones2</summary>
<link href="http://lcauto53.swg.usma.ibm.com/profiles/atom/profile.do?email=ajones2@janet.iris.com" type="application/atom+xml">
</link>
<link href="http://lcauto53.swg.usma.ibm.com/profiles/vcard/profile.do?email=ajones2@janet.iris.com" type="text/directory">
</link>
<content type="xhtml">
  <div xmlns="http://www.w3.org/1999/xhtml">
    <span>
      <a href="http://lcauto53.swg.usma.ibm.com/profiles/atom/profile.do?email=ajones2@janet.iris.com" class="url fn">Amy Jones2</a>
      <div>
        <a href="mailto:ajones2@janet.iris.com" class="email">ajones2@janet.iris.com</a>
      </div>
      <div class="x-guid">8af53b40-f6df-1032-9a75-d02a14283ea9</div>
      <div class="x-community-role">member</div>
    </span>
  </div>
</content>
<published>2015-11-11T02:19:58.379Z</published>
<updated>2015-11-11T02:19:58.379Z</updated>
<contributor>
  <email>ajones2@janet.iris.com</email>
  <snx:userid xmlns:snx="http://www.ibm.com/xmlns/prod/sn">8af53b40-f6df-1032-9a75-d02a14283ea9</snx:userid>
  <snx:userState xmlns:snx="http://www.ibm.com/xmlns/prod/sn">active</snx:userState>
  <snx:isExternal xmlns:snx="http://www.ibm.com/xmlns/prod/sn">false</snx:isExternal>
  <name>Amy Jones2</name>
</contributor>
<link href="http://lcauto53.swg.usma.ibm.com/communities/service/atom/community/members?communityUuid=2e68aa77-216c-4029-bedf-57d513abbaba&amp;userid=8af53b40-f6df-1032-9a75-d02a14283ea9" rel="self">
</link>
<link href="http://lcauto53.swg.usma.ibm.com/communities/service/atom/community/members?communityUuid=2e68aa77-216c-4029-bedf-57d513abbaba&amp;userid=8af53b40-f6df-1032-9a75-d02a14283ea9" rel="edit">
</link>
<snx:role xmlns:snx="http://www.ibm.com/xmlns/prod/sn" component="http://www.ibm.com/xmlns/prod/sn/communities">member</snx:role>
<category term="person" scheme="http://www.ibm.com/xmlns/prod/sn/type">
</category>
<snx:orgId xmlns:snx="http://www.ibm.com/xmlns/prod/sn">a</snx:orgId>

Paul Bastide
  • 1,505
  • 4
  • 17
  • 22
  • I can't check until Monday but I believe we are sending application/atom+xml, are you saying it should be application/atomcat+xml? – Ademund Nov 07 '15 at 15:59
  • Same result regardless of content-type – Ademund Nov 09 '15 at 09:39
  • did you try the feed format? and what version do you have 4.0 4.5 5.0? are you using this with the hosted version (IBM Connections Cloud) or on-premises? what logs do you have? what's your exact response code and your exact response payload? – Paul Bastide Nov 09 '15 at 12:21
  • Yes, I tried the feed format. This is v5 Cloud. The response code is a 400 ` 400 Invalid member entry. ` – Ademund Nov 09 '15 at 14:18
  • are you using the email? if so, try using the user id. – Paul Bastide Nov 10 '15 at 12:39
  • I was using the email address, but the user id gives the same error. Both ways work fine if just post an entry, as soon as I wrap it it in a feed I get a 400 - Invalid member entry. I've tried all different combinations of namespaces with no joy. – Ademund Nov 10 '15 at 14:58