Skip to content

Instantly share code, notes, and snippets.

@choyno
Created April 14, 2020 01:21
Show Gist options
  • Save choyno/39d0751c618e1ecaadb56f7ddfc411c6 to your computer and use it in GitHub Desktop.
Save choyno/39d0751c618e1ecaadb56f7ddfc411c6 to your computer and use it in GitHub Desktop.
Json sample
#!/bin/ruby
include HTTParty
fields = []
fields << {"Name" => "rocksoftware22", "Component" => "precise4"}
fields << {"Name" => "rocksoftware", "Component" => "precise5"}
params_hash ={}
params_hash[:Sources] = fields
params_hash[:SourceKind] = "local"
params_hash[:Distribution] = "binary1"
params_hash.to_json
@result = HTTParty.post("http://127.0.0.1:8082/api/publish", :headers => {'Content-Type'=>'application/json'}, :body => params_hash.to_json,)
#root@vagrant-ubuntu-precise-64:~# aptly publish list
#Published repositories:
# * ./binary1 [amd64, i386] publishes {precise4: [rocksoftware22]}, {precise5: [rocksoftware]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment