VMware {code} Community
petermie
Enthusiast
Enthusiast

REST API for content library item not recognizing library ID

Hello,

I'm trying to use the REST API to deploy a content library template, but I'm having problems getting the item ID. If I do a GET to /api/content/library, I successfully get back a list of my libraries and if I do a GET to /api/content/library/{library_id} using one of the IDs I get back from /api/content/library I get details of that library ok so I know my library ID should be good. My problem is if I do a GET to /api/content/library/item?library_id using any of the IDs that work on the other GETs, I get back this:

{
    "error_type": "INVALID_ARGUMENT",
    "messages": [
        {
            "args": [
                "library_id"
            ],
            "default_message": "Invalid value for property with name: library_id.",
            "id": "com.vmware.vapi.rest.invalidProperty"
        }
    ]
}

and I have no idea why. All the documentation I read points to this should work fine but for some reason it doesn't. Do I need to use a different library ID somehow or prefix it somehow? It seems like the other arguments on /api/vcenter/vm-template/library-items/{template_library_item}?action=deploy use MoRefs but the IDs I'm getting back from /api/content/library are more like GUIDs?

Reply
0 Kudos
1 Reply
petermie
Enthusiast
Enthusiast

Found a bit of a workaround: if I post to /api/content/library/item?action=find with my content library ID, I get the item IDs in that content library and I can filter by name in the request (if I know it first) so I can work with that for my needs. I with I knew why getting to /api/content/library/item?library_id with my library ID doesn't work though

Reply
0 Kudos