/// <summary> /// Renames a UserDefinedField /// </summary> /// <param name="TypeID">The type to which the field belongs</param> /// <param name="FieldID">The original field name</param> /// <param name="newFieldID">The new field Name</param> /// <returns>The updated Feild</returns> /// <remarks> /// 1.Attempt to Rename a field that is not a "User Defined Field" retruns Bad Request /// </remarks> public Field_MetaData RenameUserDefinedField(long TypeID, string FieldID, string newFieldID) { string RequestUri = string.Format(@"meta_data/{0}/types/{1}/fields/{2}/rename", this.ResourceName, TypeID.ToString(), FieldID); Dictionary <string, string> dicQueryStringParameters = new Dictionary <string, string>(); string putBody = PepperiJsonSerializer.Serialize(new { FieldID = newFieldID }); //null values are not serialized string contentType = "application/json"; string accept = "application/json"; PepperiHttpClient PepperiHttpClient = new PepperiHttpClient(this.Authentication, this.Logger); PepperiHttpClientResponse PepperiHttpClientResponse = PepperiHttpClient.PutStringContent( ApiBaseUri, RequestUri, dicQueryStringParameters, putBody, contentType, accept ); PepperiHttpClient.HandleError(PepperiHttpClientResponse); Field_MetaData result = PepperiJsonSerializer.DeserializeOne <Field_MetaData>(PepperiHttpClientResponse.Body); return(result); }
/// <summary> /// Upserts a UserDefinedField /// </summary> /// <param name="Field"></param> /// <returns></returns> /// <remarks> /// 1.Attempt to Upsert a field that is not a "User Defined Field" retruns Bad Request /// </remarks> public Field_MetaData UpsertUserDefinedField(Field_MetaData Field) { string RequestUri = string.Format(@"meta_data/{0}/fields", this.ResourceName); Dictionary <string, string> dicQueryStringParameters = new Dictionary <string, string>(); string postBody = PepperiJsonSerializer.Serialize(Field); //null values are not serialized string contentType = "application/json"; string accept = "application/json"; PepperiHttpClient PepperiHttpClient = new PepperiHttpClient(this.Authentication, this.Logger); PepperiHttpClientResponse PepperiHttpClientResponse = PepperiHttpClient.PostStringContent( ApiBaseUri, RequestUri, dicQueryStringParameters, postBody, contentType, accept ); PepperiHttpClient.HandleError(PepperiHttpClientResponse); Field_MetaData result = PepperiJsonSerializer.DeserializeOne <Field_MetaData>(PepperiHttpClientResponse.Body); return(result); }