Skip to content

Instantly share code, notes, and snippets.

@craigmarksmith
Created November 11, 2014 04:56
Show Gist options
  • Save craigmarksmith/35adf07e097e71189623 to your computer and use it in GitHub Desktop.
Save craigmarksmith/35adf07e097e71189623 to your computer and use it in GitHub Desktop.
conn = Faraday.new(:url => 'http://AJANIS_IP_ADDRESS:4502/') do |faraday|
faraday.use Faraday::Request::BasicAuthentication, 'admin','admin'
faraday.use ForceUtf8
faraday.response :json
faraday.request :multipart
faraday.request :url_encoded
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
end
payload = {
description: 'a test',
title: 'test command line',
tags: ['workflow:projects','workflow:projects/wcm'],
center_service_ref: 'commandline-test-boc', #per anjani, full referring url works fine
path: '/scentre-group/center/au/bondijunction',
boc_user: "test@westfield.com",
initial_boc_user: "test@westfield.com",
upload_file: Faraday::UploadIO.new('/PATH/TO/testimage.jpg', 'image/jpeg')
}
r = conn.post("/bin/dam/api/upload", payload)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment