public async Task <AgreementCreationResponse> CreateAgreement(AgreementCreationInfo agreementCreationInfo, string messageInitiatorEmail) { var jsonContent = API.SerializeJSon <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, messageInitiatorEmail); return(API.DeserializeJSon <AgreementCreationResponse>(json)); }
/// <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 <AccessToken> GetAccessTokenByRefreshToken(string apiURL, string refresh_token, string clientid, string client_secret) { AdobeRestAPI API = new AdobeRestAPI(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 <AccessToken>(json)); }