demellor | Posts: 46

delegation REST Stopped Working

0 votes

I have code that follows which I have used to setup delegation for various users.  All of the sudden users no longer have delegated access and using the code reports it setup delegation but it doesn't work.  We have a main account where users are created, they are assigned rights in a subaccount and in that subaccount is the "user" where I setup delegation.  Has the API call changed at all?

 

                   StringContent tmpDelegationpayload2 = new StringContent(subaccountId, System.Text.Encoding.UTF8, "application/json");
                    response = await tempDelegateClient.PostAsync(new Uri($"{baseURL}/api/account/senders/{MatchingSourceuser.AccountID}/delegates/{MatchingTargetUser.AccountID}"), tmpDelegationpayload2);
 

Assume the values in the commands are correct because they code is unchanged and has worked for a couple years.  People who had delegation lost their access also, so it was fine?  Do I need to add something to make it work again and restore the people who no longer have access ?


Approved Answer
Duo_Liang | Posts: 3776

Reply to: delegation REST Stopped Working

0 votes

Hi Richard,

 

Just did a quick test and looks like both below two APIs works for me:
(1)POST /api/account/senders/dYCOOx6FJGgJ/delegates/S05qBPhbjukH

Note that I didn't really send the subaccount ID as the payload, instead, the API Key I am using is the subaccount level API Key, instead of the main account level API Key

 

(2)POST /api/account/delegates/dYCOOx6FJGgJ

With payload: 

[
  {
    "id": "fpy5BwvR2n8D"
  },
  {
    "id": "S05qBPhbjukH"
  }
]

This second API seems to be newly introduced, which allows to add multiple delegates in one call. Again, I didn't specify the subaccount somewhere, but to use the subaccount level API Key.

 

Duo


demellor | Posts: 46

Reply to: delegation REST Stopped Working

0 votes

I just found that the problem happens when doing things via the UI so it must not be related to the API.  Sorry for the distraction.  Thank you for the answer.

 

 


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off