string domen = project.Variables["wp_domen"].Value; // домен вида https://домен.ру
string id = project.Variables["wp_image_id"].Value; // id фото в библиотеке
string title = project.Variables["img_title"].Value; // title для картинки
string pass64 = project.Variables["wp_login_pass_64"].Value;
//string content = string.Format ("\"description\": \"{0}\",\"alt_text\": \"{0}\",\"title\": \"{0}\"", title);
string content = $"\"description\": \"{title}\",\"alt_text\": \"{title}\",\"title\": \"{title}\""; // json запрос
string[] headers = new[]
{
"Authorization:Basic " + pass64
};
// project.SendInfoToLog ("{"+ content +"}");
string response = ZennoPoster.HTTP.Request
(
InterfacesLibrary.Enums.Http.HttpMethod.POST,
url: $"{domen}/wp-json/wp/v2/media/{id}",
content:"{"+content+"}",
contentPostingType: "application/json",
UserAgent: project.Profile.UserAgent,
respType: ZennoLab.InterfacesLibrary.Enums.Http.ResponceType.HeaderAndBody,
AdditionalHeaders: headers
);
if (!response.Contains("200 OK")) //проверка на содержание в response данных из скобок
throw new Exception($"Ошибка в ответе \n{response}"); // вывод при ошибке
//return response;