如何使用Groups API在LinkedIn中将帖子标记为作业?
我有帖子的PostId。我唯一需要做的就是将该帖子标记为作业,以便它将显示在LinkedIn组的“工作讨论”部分中。
但是当我调用API时,它会给我一个400 Bad Request Error。有谁知道为什么?
答案 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