I’m trying to make a POST request here, but it does not work and shows HTTP 400 bad request. Any ideas?
local HS = game:GetService("HttpService")
local APP_ID = 'myappidhere'
local API_KEY = 'myapikeyhere'
local MODEL_ID = 'moderation-recognition';
local MODEL_VERSION_ID = 'aa8be956dbaa4b7a858826a84253cab9';
local IMAGE_URL = 'https://cdns-images.dzcdn.net/images/artist/df76fa73a458af753cbe9e5ae64a33cd/500x500.jpg'
local API_URL = 'https://api.clarifai.com/v2/models/'..MODEL_ID..'/versions/'..MODEL_VERSION_ID..'/outputs'
local PAYLOAD = {
inputs = {
data = {
image = {
url = IMAGE_URL
}
}
}
}
local success, message = pcall(function()
local imageResult = HS:PostAsync(API_URL, HS:JSONEncode(PAYLOAD), nil, nil, {['Authorization'] = 'Key '..API_KEY})
end)
if not success then print (success, message) end
What am I doing wrong?