cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
vRaj1
Community Participant

Error 500 when creating sub account via API c#

Jump to solution

Dear,

I'm referring to the below URL to create a sub-account. I'm passing all five parameters, which mentioned but still, I'm getting errors while creating sub-account.  :https://canvas.instructure.com/doc/api/accounts.html#method.sub_accounts.create

Create a new sub-account

POST /api/v1/accounts/:account_id/sub_accounts

Thanks.

Labels (1)
Tags (1)
0 Kudos
2 Solutions

Accepted Solutions
robotcars
Community Champion

Hi @vRaj1 

Nest all those values within 'account' object and ensure that the :account_id represents the parent_account for the created sub account.

Payload Example

{"account":{"name":"Create Via API","sis_account_id":"API_sub_account"}}

 

 

View solution in original post

robotcars
Community Champion

@vRaj1 

Canvas is confusing in this aspect, but Accounts are like Folders, where you can put courses, and change settings, with different Users who can be given permissions of those Accounts.

Users are not stored in Accounts, and are held within the Root Account (your school). To create Users, check out https://canvas.instructure.com/doc/api/users.html#method.users.create

View solution in original post

0 Kudos
6 Replies
robotcars
Community Champion

Can you share an example of your request?

The endpoint for create, has nested params within 'account'.

 

vRaj1
Community Participant

Here is the sample.

CreateUser lobjacc = new CreateUser
{
name = "yyyyy",
sis_account_id = "xxxx",
efault_storage_quota_mb = 500,
default_user_storage_quota_mb = 50,
default_group_storage_quota_mb = 50
};

JsonString as

{"name":"yyyyy","sis_account_id":"xxxx","efault_storage_quota_mb":500,"default_user_storage_quota_mb":50,"default_group_storage_quota_mb":50}

robotcars
Community Champion

Hi @vRaj1 

Nest all those values within 'account' object and ensure that the :account_id represents the parent_account for the created sub account.

Payload Example

{"account":{"name":"Create Via API","sis_account_id":"API_sub_account"}}

 

 

View solution in original post

vRaj1
Community Participant

Many Thanks, Robocar 🙂

The suggested Json is working however I couldn't able to find the created user under "People"

I would like to add more parameters where should I refer? like email,integration_id, authentication_provider_id,first_name etc

Is there a link to get a list of parameters?

Thank you.

robotcars
Community Champion

@vRaj1 

Canvas is confusing in this aspect, but Accounts are like Folders, where you can put courses, and change settings, with different Users who can be given permissions of those Accounts.

Users are not stored in Accounts, and are held within the Root Account (your school). To create Users, check out https://canvas.instructure.com/doc/api/users.html#method.users.create

View solution in original post

0 Kudos
vRaj1
Community Participant

Thanks its working fine now 🙂