Я очень новичок в HTTR и связи с API R. Я не могу соединиться с FACE API (документация: https://face -api.sightcorp.com / dev-Documentation / )
library(httr) library("XML") library("jsonlite") library(RCurl) key = 'XXX' img = 'C:\\my_image.jpg' The query: my_json <- POST('https://api-face.sightcorp.com/api/detect/', add_headers(app_key = key, img = img, ethnicity = TRUE )) print(my_json)
и ответ:
Response [https://api-face.sightcorp.com/api/detect/] Date: 2019-02-19 20:26 Status: 200 Content-Type: application/json Size: 88 B { "error_code" : 1200, "description" : "__all__ : img or url parameter is needed."
Как мне внедрить адрес img или url в код для получения анализа API?
Решение заключается в следующем:
my_body = list('app_key'=key, 'img'= upload_file(img.url)) my_json <- POST('https://api-face.sightcorp.com/api/detect/',body = my_body)