コード例 #1
0
        public async Task <AdobeSign.AgreementCreationResponse> CreateAgreement(AdobeSign.AgreementCreationInfo agreementCreationInfo)
        {
            var jsonContent = API.SerializeJSon <AdobeSign.AgreementCreationInfo>(agreementCreationInfo);
            var buffer      = System.Text.Encoding.UTF8.GetBytes(jsonContent);
            var byteContent = new ByteArrayContent(buffer);

            byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

            string json = await API.PostRest("/agreements", byteContent);

            return(API.DeserializeJSon <AdobeSign.AgreementCreationResponse>(json));
        }
コード例 #2
0
        /// <summary>
        /// Get Access Token using refresh token
        /// </summary>
        /// <param name="apiURL">API Uri</param>
        /// <param name="refresh_token">Refresh Token, which can be used to get a fresh Access Token</param>
        /// <param name="clientid">Application ID - obtained from OAuth Configuration page / Identifies the application</param>
        /// <param name="client_secret">Client secret key - obtained from OAuth Configuration page / Authenticates the application</param>
        /// <returns>AccessToken object - Refresh_token property would be null on this call.</returns>
        public static async Task <AdobeSign.AccessToken> GetAccessTokenByRefreshToken(string apiURL, string refresh_token, string clientid, string client_secret)
        {
            RestAPI API = new RestAPI(apiURL, "");

            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("refresh_token", refresh_token);
            parameters.Add("client_id", clientid);
            parameters.Add("client_secret", client_secret);
            parameters.Add("grant_type", "refresh_token");

            FormUrlEncodedContent encodedContent = new FormUrlEncodedContent(parameters);

            string json = await API.PostRest("/oauth/refresh", encodedContent, "application/x-www-form-urlencoded");

            return(API.DeserializeJSon <AdobeSign.AccessToken>(json));
        }
コード例 #3
0
        public static async Task <AdobeSign.AccessToken> GetAccessToken(string apiURL, string authorization_code, string clientid, string client_secret, string redirectURL, string grant_type = "authorization_code")
        {
            RestAPI API = new RestAPI(apiURL, "");

            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("code", authorization_code);
            parameters.Add("client_id", clientid);
            parameters.Add("client_secret", client_secret);
            parameters.Add("redirect_uri", redirectURL);
            parameters.Add("grant_type", grant_type);

            FormUrlEncodedContent encodedContent = new FormUrlEncodedContent(parameters);

            string json = await API.PostRest("/oauth/token", encodedContent, "application/x-www-form-urlencoded");

            return(API.DeserializeJSon <AdobeSign.AccessToken>(json));
        }