I know I am a horrible coder. I tried below code snippet for REST Delete. But the Rest context returning me a null instead of Id even though I passed an Id from Workbench Rest explorer. Here is my code:

global with sharing class RESTQLIDelCon {
  global static String deleteQLI() {
    Id QuoteId = RestContext.request.params.get('Id');
    //System.debug('RestContext.request.params'+ RestContext);
    System.debug('Id======>' + QuoteId);
    Quote DelQuote = [ Select ID from Quote where Id = :QuoteId];

    List<QuoteLineItem> DelQLI= [SELECT Id, LineNumber from QuoteLineItem WHERE QuoteId =: DelQuote.Id];

    delete DelQLI;
    return 'Quote Line Items are deleted';
    return 'Quote Line Items are not deleted due to some issues';
  • The below is the URL, I tried from Workbench: /services/apexrest/QLIDelete?id=0Q0n0000000XY61ABC Commented Feb 20, 2018 at 0:05

1 Answer 1


Apex maps are case sensitive. You are requesting the key 'Id', but the URL provides the parameter 'id'. That's why you're obtaining a null value.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .