0

I read in this answer: facebook api hide comment that you can hide a Facebook comment using this cURL request:

curl -XPOST \
     -k \
     -F 'is_hidden=true' \
     -F 'access_token=[access_token]' \
     https://graph.facebook.com/v2.4/[comment_id]

How can I make that request in C#?

Please give a clear working code.

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
KADEM Mohammed
  • 1,650
  • 2
  • 23
  • 45
  • 1
    It's just POST request with is_hidden=true&access_token=[access_token] in body, you can find a lot of information over internet about how to make POST requests in .NET, for example: https://stackoverflow.com/a/4015346/5311735 – Evk Oct 09 '17 at 15:29

1 Answers1

1

I think the -F flag means it is part of a multipart form: https://ec.haxx.se/http-multipart.html

This may not necessarily work but it should give an idea:

        using (var client = new HttpClient())
        {
            using (var content =
                new MultipartFormDataContent("upload----" + DateTime.Now.ToString(CultureInfo.InvariantCulture)))
            {
                content.Add(new StringContent("true"), "is_hidden");
                content.Add(new StringContent("[access_token]"), "access_token");

                var response = client.PostAsync(new Uri("https://graph.facebook.com/v2.4/[comment_id]"), 
                                               content).Result; // You could use await here

            }
        }
Matt
  • 2,691
  • 3
  • 22
  • 36