1

I have functionality where I need send delivery payload with static basic token and additional header.

scope = "xapi:read" # some require xapi:read, some require xapi:all
client_auth_header = "Basic <insert token here>"
client_version_header = "1.0.3"
client_site = "<Provided by client>"

I need to do this with post request


curl --request GET \
  --url https://client-url/data/xAPI/agents \
  --header 'Authorization: Basic XYZABC' \
  --header 'X-Experience-API-Version: 1.0.3'

How do I write a post request in ruby ?

with something like this

client.post("/xAPI/statements", body: data.to_json, headers: { "Content-Type" => "application/json" })

what should I replace the client with ?

Mag
  • 49
  • 2

1 Answers1

1

The httparty gem supports a very similar API to what you described here, with HTTParty.post.

maetl
  • 878
  • 6
  • 16