Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to create LABRESOURCE using REST API with example ?

Hello everyone,

I am trying to create Labresource using REST API through postman. 
But i am getting HTTP 500 (Internal Server Error) or HTTP 400 (Bad request) in response.
I have basic queries below
1. What is external provider id or resource in case of lab resource creation ?
2. Looking for sample post URL with payload (Sample XML) for creating lab resource.
3. what is the link between external provider and lab resource ? Does external provider id requires in post URL for lab resource creation ?
4. what is the internal id and what if where the internal id of the resource.is not available ?
5.Post request rest API example (Sample XML) with internal resource id for lab resource ?

0 votes

Comments

What's an example of a URL you've tried, presumably a POST?

Here is the post URL and its body that i fired through postman


In the above URL 1 is extrenal provider id and format=tdm is passed. Here i don't have any external id i have just passed it as like ramdom id. I have to create labresource without external id but it resonses as bad request and where with above post url which has external id gives insernal server error


What headers did you send? Did you use a configuration in either query parameter oslc_config.context or header Configuration-Context?


Don't understand why the response would vary between 400 and 500 - 500 is usually associated with IHS reverse proxy. was there any text in the response body?

  Below are headers


Content-Type -> application/atom+xml 

Connection -> keep-alive 

Accept -> */* 

Accept-Encoding -> gzip, deflate, br  

<feed xmlns="http://www.w3.org/2005/Atom"> <entry> <content> <qm:labresource > <qm:name>labmachine</qm:name> <qm:property name="Machine"/> <qm:property value="labmachine" name="Machine.name"/> <qm:property name="Machine.operatingsystem.OS/2"/> <qm:property value="x86-64" name="Machine.operatingsystem.OS/2.KernelArchitecture"/> <qm:property value="64 bit" name="Machine.operatingsystem.OS/2.KernelWidth"/> <qm:property value="I India Time Zone Military UTC + 9 hours" name="Machine.operatingsystem.OS/2.TimeZone"/> <qm:property value="PC" name="Machine.operatingsystem.OS/2.Type"/> <qm:property value="Available" name="Machine.Operational Status"/> </qm:labresource> </content> </entry> </feed>

Above last comment is post request body

Why are you using Content-Type application/atom+xml - the reqmapi document doesn't mention this at all except for bulk upload which you're not doing? Use Content-Type and Accept application/xml.

Did you try GET on an existing lab resource (with Accept: application/xml) to see the XML structure needed?

The rqmapi doc has this tip - have you tried it?
Tip:
To determine the XML representation of the resource:
* Read an existing resource as XML with abbreviate=false. [use Accept: application/xml]
* Delete the read-only properties (see Detailed Schema Documentation for read-only properties).
* Add/modify/delete the writable properties (see Detailed Schema Documentation for writable properties). [PUT/POST with Content-Type: application/xml]

The internal ID typically refers to the unique identifier generated by the platform database after a resource is created, so if it is not available yet, the request normally uses the external identifier instead. 

1 vote

showing 5 of 9 show 4 more comments


One answer

Permanent link

Hello Ian Barnard

I got the solution. Below are the details to create labresource through API (I have used postman for testing)

-------------------------------------------------------------------
LABRESOURCE POST URL (new lab resource creation) -> 

https://server_FQDN:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/JKE_Banking_CM_Junit_Testing/labresource/XLS/XLS/TestVMLabCreationAPI

In above URL TestVMLabCreationAPI is labresource name or title (Both name and title are same)
In above URL XLS/XLS why it is required to create i don't know. Not mentioned in document. I found it on forum in another question,

-------------------------------------------------------------------
Below are POST request Headers 

Content-Type : application/xml
Accept : /

-------------------------------------------------------------------

Below is the XML passed in POST request body
<title>TestVMLabCreationAPI</title>
    <description>created for testing purpose through postman</description>
    <type>VirtualImage</type>
    <name>TestVMLabCreationAPI</name>
    <memory>1024</memory>
   <osType>RedHat 7.2</osType>
    <osKernelWidth>64 bit</osKernelWidth>
    <diskspace>3000</diskspace>
</labresource>
----------------------------------------------------------------------

Response received is 201 Created
Checked in application Labresource was created successfully and was able to see in UI. 

----------------------------------------------------------------------

 i don't know why 
XLS/XLS  is required in labresource creation POST URL https://server_FQDN:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/JKE_Banking_CM_Junit_Testing/labresource/XLS/XLS/TestVMLabCreationAPI

And strangely it has not been documented anywhere. The same has been asked in other questions as well.  

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 489
× 20
× 3

Question asked: Nov 24 '25, 12:23 a.m.

Question was seen: 1,286 times

Last updated: Mar 15, 8:01 p.m.

Related questions
Confirmation Cancel Confirm