If you haven’t already found the API document its available on the support document. Unfortunately there isn’t (wasn’t?) a good way to express sets of mandatory fields.
Probably you’d want to take a look at the Upload UI to get an idea about what is required for each format.
I appreciate the quick reply. Perhaps I missed it but I have not found anything on the Swaqger page or the Components API documentation that provides a list of mandatory fields. In this case there is just “repository” and “npm,asset” for the swagger page (same for the Component API). Is there another resource that outlines that information? I have successfully used the process outlined here to populate a maven repo.
Right that was what I was getting at, the endpoint works across formats and Swagger doesn’t have a way to my knowledge to group parameters together.
This is why I suggest taking a look at the user interface for Upload, its backed by the same logic so if you should hopefully be able to mentally map fields in the UI to the API to understand which are mandatory (or if you know enough about the given format you may already know this).
Checking the UI’s Upload, it shows pretty much the same as Swagger, just the file (no name or version placeholders). However I think I may have it fixed as I discovered a bug I had in my tarball construction. Must be the API gets params from the tarball as the package.json was not at the appropriate level. Fixed my tarball issue and now no errors. Thanks for your help.
For row (hosted) there is more simple way to upload file.
May this way can be good for you
curl -u USERNAME:USERPASSWD --upload-file PathToYourFile https://FQDN/repository/repoName/FolderInRepo/YourFile.tgz
If you haven`t https - change to http.
USERNAME - Nexus user
USERPASSWD - Nexus user password
PathToYourFile - path to file witch you want to upload
If you’re using Ansible, I’m about to release a raw_component module that enables you to upload files/components to raw repositories.
The Ansible task is currently looks like the following:
- name: Upload artifact to Nexus
cloudkrafter.nexus.raw_component:
file: /tmp/package.tar.gz # file to be uploaded when state is present
state: present # when absent, filename will be deleted from repository
directory: /some-directory # Default is '/' for the root of the repository
filename: package-name.tar.gz # name of component once uploaded
repository: https://nexus.instance.local/repository/<repo_name>
username: "{{ nexus_username }}"
password: "{{ nexus_password }}" # use token or password
usertoken: "{{ nexus_usertoken }}" # use token or password
validate_certs: true