public static string PutNode(this HttpClient client, Node node) { var json = JsonConvert.SerializeObject(node); var result = client.PutAsync($"/episerverapi/commerce/nodes/{node.Code.ToLower()}", new StringContent(json, Encoding.UTF8, "application/json")) .Result.Content.ReadAsStringAsync() .Result; return result; }
public static string PostNode(this HttpClient client, Node entry) { var json = JsonConvert.SerializeObject(entry); var result = client.PostAsync("/episerverapi/commerce/nodes", new StringContent(json, Encoding.UTF8, "application/json")) .Result.Content.ReadAsStringAsync() .Result; return result; }
public static string ConnectEntryToNode(this HttpClient client, Node node, Entry entry) { var model = new NodeEntryRelation() { EntryCode = entry.Code, NodeCode = node.Code, SortOrder = 0 }; var json = JsonConvert.SerializeObject(model); var result = client.PostAsync($"episerverapi/commerce/entries/{entry.Code}/nodeentryrelations", new StringContent(json, Encoding.UTF8, "application/json")) .Result.Content.ReadAsStringAsync() .Result; return result; }