Add ckan license to uploaded file from java -


i have created java client uploads files ckan installation. add license on file. ckan docs see there json file on ckan installation available licences, not sure how can use on client example taken ckan docs

licenses_group_url = file:///path/to/my/local/json-list-of-licenses.json licenses_group_url = http://licenses.opendefinition.org/licenses/groups/od.json 

part of client programm

contentbody cbfile = new filebody(file, contenttype.text_html); httpentity reqentity = multipartentitybuilder.create()     .addpart("file", cbfile)     .addpart("key", new stringbody(uploadfilename+date,contenttype.text_plain))     .addpart("package_id",new stringbody("test2",contenttype.text_plain))     .addpart("url",new stringbody(host+"/files/"+date+"/test.txt",contenttype.text_plain))     .addpart("upload",cbfile)     .addpart("comment",new stringbody("comments",contenttype.text_plain))     .addpart("notes", new stringbody("notes",contenttype.text_plain))     .addpart("author",new stringbody("authorname",contenttype.text_plain))     .addpart("author_email",new stringbody("authoremail",contenttype.text_plain))     .addpart("title",new stringbody("title",contenttype.text_plain))     .addpart("description",new stringbody("file desc"+date,contenttype.text_plain))     .build(); 

update
after odis hint realised wrong along (aparently).
turns out license of file automatically set license of dataset. uploading file dataset out license file had no license. when used .addpart("license_id", new stringbody("cc-by-4.0",contenttype.text_plain)) still getting no license on file. when changed licence of dataset, no matter if used command or not, or if used other license id, still getting same license of dataset.

that makes no sence me honest. cant have dataset license , of files use different licenses? confirm please?

the json referred license_group_file.

if @ 1 of entries, that:

{     status: "active",     maintainer: "creative commons",     od_conformance: "approved",     family: "",     osd_conformance: "not reviewed",     domain_data: true,     title: "creative commons attribution 4.0",     is_okd_compliant: true,     domain_content: true,     url: "https://creativecommons.org/licenses/by/4.0/",     is_osi_compliant: "not reviewed",     domain_software: false,     id: "cc-by-4.0" } 

as can see there id field. can use when create dataset. pass value (in example above cc-by-4.0) of license in field called license_id (see docs available fields)


Comments