Thanks, but I can’t do with it.
No other settings required?
require 'httparty'
strapi_api_key = 'MY_API_KEY'
strapi_base_endpoint = 'http://localhost:1337'
headers = {
"Authorization" => "Bearer #{strapi_api_key}"
}
options = {}
options[:headers] = headers
options[:body] = {
data: {
title: 'test',
status: 'draft', # or 'Draft'
}
}
res = HTTParty.post(strapi_base_endpoint + '/api/foos', options)
p res.body # returns "{\"data\":{\"id\":4,\"attributes\":{\"title\":\"test\",\"createdAt\":\"2023-12-21T08:51:40.266Z\",\"updatedAt\":\"2023-12-21T08:51:40.266Z\",\"publishedAt\":\"2023-12-21T08:51:40.266Z\"}},\"meta\":{}}"