i am a newbie to docusign and api's in general. i have created a master account manually on docusign and now i want to create new users using this account and use the send on behalf functionality. I have already gone through this pdf (http://www.docusign.com/sites/default/files/REST_API_Guide_v2.pdf). But can anyone explain in layman's terms what are the exact steps that i need to follow? Thanks
问题:
回答1:
Please go through the DocuSign Dev Center as there is some very useful information throughout the site, including the exact SOBO (Send On Behalf Of) steps that you are looking for.
Go to Dev Center -> Explore -> Features -> SOBO. Generally speaking these are steps you need to take:
- Obtain an access token for User1 (the authenticating user)
- Obtain an access token for User2 (the operating user - you're sending on behalf of this person)
- Send Request on behalf of User2
See this page of the Dev Center for the exact steps to take and potential account settings you need to have turned on:
http://www.docusign.com/developer-center/explore/features/sobo
To summarize what the page explains and have the answer here too, here are the details:
STEP #1:
POST https://{server}/restapi/{apiVersion}/oauth2/token
Accept: application/json
Content-Type: application/x-www-form-urlencoded
Content-Length: {length of body}
grant_type=password&client_id={IntegratorKey}&username={email}&password={password}&scope=api
Make sure you supply your account email, password, and integrator key in the body.
A successful response returns the following JSON:
{
"access_token": "<access token for user>",
"scope": "api",
"token_type": "bearer"
}
STEP #2:
Here you add the header Authorization: bearer <access_token>
where <access_token>
is the token that was returned in step 1 and the email is now the email address of the user you want to send on behalf of:
POST https://{server}/restapi/{apiVersion}/oauth2/token
Authorization: bearer <access token>
Accept: application/json
Content-Type: application/x-www-form-urlencoded
Content-Length: {length of body}
grant_type=password&client_id={IntegratorKey}&username={$emailOnBehalf}&password={password}&scope=api
The result is another access token, let's say it's 12345.
Step #3:
Now you can send on behalf of this user by using the following auth headers in your signature request:
Authorization: bearer 12345
X-DocuSign-Act-As-User: $emailOnBehalf