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]

showing 5 of 8 show 3 more comments

Be the first one to answer this question!

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
× 486
× 19
× 3

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

Question was seen: 298 times

Last updated: Dec 18, 10:01 a.m.

Confirmation Cancel Confirm