在Linkedin群组中将帖子标记为促销或作业

时间:2011-11-09 13:48:40

标签: .net linkedin

如何使用Groups API在LinkedIn中将帖子标记为作业?

我有帖子的PostId。我唯一需要做的就是将该帖子标记为作业,以便它将显示在LinkedIn组的“工作讨论”部分中。

但是当我调用API时,它会给我一个400 Bad Request Error。有谁知道为什么?

1 个答案:

答案 0 :(得分:0)

解决方案类似于此功能

access_token是您的令牌oauth2

idP是帖子的ID

Sub FlagPost(ByVal access_token As String, ByVal idP As String)

    Dim body As String = "<?xml version='1.0' encoding='UTF-8'?><code>job</code>"

    Dim flagasjob As HttpWebRequest = HttpWebRequest.Create("https://api.linkedin.com/v1/posts/" & idP & "/category/code?oauth2_access_token=" & access_token)


    flagasjob.ContentType = "text/xml"
    flagasjob.Method = "PUT"

    Dim codFlag As UTF8Encoding = New UTF8Encoding()
    Dim bytesFlag As Byte() = codFlag.GetBytes(body)
    flagasjob.ContentLength = bytesFlag.Length

    Dim stmFlag As Stream
    stmFlag = flagasjob.GetRequestStream()
    stmFlag.Write(bytesFlag, 0, bytesFlag.Length)
    stmFlag.Close()

End Sub