HowTo: Quality Center / REST API / VBScript – Update Field Value
Question ID: 105772
1
0

How Do I update a field value (such as defect field) using REST API / VBScript?

Marked as spam
Posted by (Questions: 122, Answers: 3)
Asked on January 2, 2015 6:32 pm
60 views
Answers (1)
1
Private answer

**Example:**

Sub FieldUpdate()

Dim XMLHttpRequestObj, ALMServer, ALMDomain, ALMProject, EntityType, EntityID, FieldName, FieldNewValue, ReqUpdateStr

Set XMLHttpRequestObj = CreateObject(''Msxml2.ServerXMLHTTP.6.0'')

ALMServer = ''http://localhost:8080/qcbin'' ''<--No trailing slash ALMDomain = ''DEFAULT'' ALMProject = ''ALM_DEMO'' EntityType = ''defect'' ''<--Singular/(no ''s'') (Example: defect, design-step, requirement, run, run-step, test, test-set) EntityID = ''1'' FieldName = ''owner'' FieldNewValue = ''alex_alm'' ReqUpdateStr = '''' & FieldNewValue & ''''

XMLHttpRequestObj.open ''PUT'', ALMServer & ''/rest/domains/'' & ALMDomain & ''/projects/'' & ALMProject &''/'' & EntityType & ''s/'' & EntityID, False
XMLHttpRequestObj.setRequestHeader ''Content-Type'',''application/xml''
XMLHttpRequestObj.setRequestHeader ''Accept'',''application/xml''
XMLHttpRequestObj.send(ReqUpdateStr)

MsgBox ''-- Field Update --'' & vbCrLf & _
''Status Code : '' & XMLHttpRequestObj.status & vbCrLf & _
''Status Text : '' & XMLHttpRequestObj.statusText & vbCrLf & _
''-------------------'' & vbCrLf & _
''Response Text : '' & vbCrLf & XMLHttpRequestObj.responseText, , ''Field Update''

Set XMLHttpRequestObj = Nothing

End Sub

Marked as spam
Posted by (Questions: 3, Answers: 168)
Answered on January 2, 2015 6:37 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top