How to null out a field in CA Agile Central using the Java Toolkit.
search cancel

How to null out a field in CA Agile Central using the Java Toolkit.

book

Article ID: 10242

calendar_today

Updated On:

Products

Rally On-Premise Rally SaaS

Issue/Introduction

This example will explain how to null out a non-required field by sending a null value in your request using the Java toolkit.



Environment

Release:
Component: ACAPI

Resolution

1. Make sure you have the gson.JsonNull class imported into your .java class file.

import com.google.gson.JsonNull;

2. Create a new JSON Object.

JsonObject newDefectUpdate = new JsonObject();

3. Set the property using the add method and the JsonNull.INSTANCE class constant.

newDefectUpdate.add("c_CustomDate", JsonNull.INSTANCE );

4. Send your request for the artifact.

UpdateRequest updateRequest = new UpdateRequest("/defect/<OID>", newDefectUpdate);