Recent searches


No recent searches

Problems using organization_memberships > create_many



Posted Jan 25, 2022

I'm trying to send a POST request to /api/v2/organization_memberships/create_many but always get this response:

error: TooManyValues
description: Parameter organization_memberships cannot specify more than 1 values
max_count: 1

Which seems odd for a create_many endpoint. The request body is

{
"organization_memberships": [
{
"user_id":388246483398,
"organization_id":360606612137
}
]
}

Just wondering if anyone has seen this before, and have any ideas what the problem might be? Any help would be most appreciated.


0

6

6 comments

image avatar

Eric Nelson

Zendesk Developer Advocacy

Hey Ashley, 

That's quite odd, in your request body I'm only seeing one membership listed. In your actual response are you including more than one object in that array? 

0


Sorry, I was trying to show the format, but made it confusing.

If I send one membership in the body, it appears to work. If I send more than one membership, I get that error.

0


Hey Ashley Johnson,

Based on the error description, I'm guessing that the "organization_memberships" parameter has more than one array, like this maybe:

{
"organization_memberships": [
{ "user_id": 12345, "organization_id": 9001 }
],
[
{ "user_id": 67890, "organization_id": 9001 }
]
}

instead of one array with multiple objects, like this:

{
"organization_memberships": [
{ "user_id": 12345, "organization_id": 9001 },
{ "user_id": 67890, "organization_id": 9001 }
]
}

If that isn't the case, though, could you post a sample of the full JSON payload that triggers the error?

0


Thanks Jason, I've just tested with this:

{
"organization_memberships":[
{
"user_id":388246483398,
"organization_id":360599321098
},
{
"user_id":388246483398,
"organization_id":360599321218
},
{
"user_id":388246483398,
"organization_id":360599321238
},
{
"user_id":388246483398,
"organization_id":360599321278
},
{
"user_id":388246483398,
"organization_id":360599321338
}
]
}

0


The solution to this problem was that Zendesk has an admin option called enable multiple organisations for users which is not enabled by default. That API error message isn't clear, but enabling this option allowed me to add the organisation memberships.

 

0


Hi Zendesk community,

I am surprised that it doesn't works this way:

{
    "organization_memberships": [
        {
            "user_id": 6281526325405,
          "organization_name": "name of an organization",
        }
    ]
}

but works this way:

 

{
    "organization_memberships": [
        {
            "user_id": 6281526325405,
            "organization_id":  72762728292,
        }
    ]
}

Do you have a solution/work around please? :)

 

Best regards,

Raphaël (Solène OFFICERS)

 

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post