Hi Team,

I am building a sentiment and text mining model with R and Cognitive API. I
am getting the error as mentioned in the subject:

Request body format is wrong. Make sure the json request is serialized
correctly and there are no null members. Can you please advice what is
incorrect i am doing in the code below:

modi_df["language"] = "en"
modi_df["id"] = seq.int(nrow(modi_df))
request_body_modi = modi_df[c(2,3,1)]

# Converting tweets dataframe into JSON
request_body_json_modi = toJSON(list(documents = request_body_modi))
# Calling text analytics API


result_modi = POST("
https://westus.api.cognitive.microsoft.com/text/analytics/v2.0/sentiment";,
                    body = request_body_json_modi,
                    add_headers(.headers =
c("Content-Type"="application/json","Ocp-Apim-Subscription-Key"="bc8c8427fd74412ea51967373e418681")))

Output = content(result_modi)
Thank You!.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to