Can't create Docker Repo via Rest API

284 views
Skip to first unread message

Juliano R

unread,
Feb 9, 2017, 8:38:46 PM2/9/17
to Nexus Users
Hi, I'm having trouble creating a Docker Repository vi Rest API.

Here is the command i run:
curl -v -X POST -u admin:admin123 --header "Content-Type: application/json" 'https://localhost:8443/service/siesta/rest/v1/script' -d @/home/ubuntu/repo.json

here is my repo.json:
{
   "attributes":{
      "docker":{
         "httpsPort":5002,
         "v1Enabled":false
      },
      "storage":{
         "blobStoreName":"default",
         "strictContentTypeValidation":true,
         "writePolicy":"ALLOW"
      }
   },
   "name":"myrepo2",
   "id": "myrepo2",
   "format":"",
   "type":"",
   "content": "repository.createDockerHosted('public')",
   "url":"",
   "online":true,
   "checkbox-1281-inputEl":false,
   "checkbox-1284-inputEl":true,
   "recipe":"docker-hosted"
}

It keeps throwing me this error:
[{"id":"PARAMETER add.arg0.type","message":"may not be empty"}]

Can someone point me to the right direction? thanks

Kelly Robinson

unread,
Feb 9, 2017, 9:18:45 PM2/9/17
to Juliano R, Nexus Users
Hi Juliano,

I'm afraid the api will not work with the input you are providing. The script REST endpoint is used for managing a library of scripts, so you need to upload a Groovy script that will be run in Nexus by a following command. The full documentation for this api is available at https://books.sonatype.com/nexus-book/3.0/reference/scripting.html. Examples are available at https://github.com/sonatype/nexus-book-examples/tree/nexus-3.x/scripting. And the particular interface that is available within the script environment used to interact with Repository configuration can be found at https://github.com/sonatype/nexus-internal/blob/e28b4254688e26ea6daae74b67ad85c3936db85e/plugins/nexus-script-plugin/src/main/java/org/sonatype/nexus/script/plugin/RepositoryApi.java. Hope that helps!



--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/6abb2c89-3894-4e83-bd99-9f45d87c9a4a%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.

Reply all
Reply to author
Forward
0 new messages