Composite API: Create Person Account and Community User in a single call
for this you need to include a GET method to fetch the ID of the record created and ref that in your following POST method. Below is the payload i modified, try this. I'm positive it will work.
Side note: If you only have to create records and there isn't a need to do any kind of updates, you probably want to look at Composite TREE API which is a much simpler payload and you don't have to specify your methods in it or need to add a GET method to ref the Id of the created record
{
"compositeRequest":[
{
"method":"POST",
"url":"/services/data/v38.0/sobjects/Account",
"referenceId":"refAccount",
"body":{
"Lastname":"SampleAccount",
"RecordTypeId":"0125E000000T8IGQA0"
}
},
{
"method": "GET",
"url": "/services/data/v39.0/query/?q=SELECT+Id+FROM+Account+where+Id='@{refaccount.id}'",
"referenceId": "ref2"
},
{
"method":"POST",
"url":"/services/data/v38.0/sobjects/User",
"referenceId":"refUser",
"body":{
"lastname":"Smith",
"ContactId":"@{ref2.records[0].Id}",
"title":"President",
"email":"[email protected]",
"Username":"[email protected]",
"TimeZoneSidKey":"",
"ProfileId":"00e1i0000013UvI",
"Alias":"abc",
"LanguageLocaleKey":"DE",
"TimeZoneSidKey":"Europe/Dublin",
"LocaleSidKey":"DE",
"EmailEncodingKey":"ISO-8859-1"
}
}
]
}