I'm receiving errors which look similar to a previous question (System.JSONException: Unexpected character ('a' (code 97)): was expecting double-quote to start field name at [line:1, column:3]) to which i posted a comment however I was thinking as it's an already answered question I might need to open a new one to re-engage the conversation. (I'm not sure if comments on answered questions get picked up often) I hope that's ok!
I'm trying to test out the following API https://developer.salesforce.com/docs/atlas.en-us.cpq_dev_api.meta/cpq_dev_api/cpq_api_add_products.htm
For the sample JSON provided it does include escapes for double-quotes
{"context":"{\\"quote\\":{\\"record\\":{\\"attributes\\":{\\"type\\":\\"SBQQ__Quote__c\\",\\"url\\":\\"/services/data/v41.0/sobjects/SBQQ__Quote__c/a0p61000004IpR8AAK\\"},
\\"Name\\":\\"Q-00905\\",\\"Id\\":\\"a0p61000004IpR8AAK\\"},\\"nextKey\\":2,\\"netTotal\\":0.00,\\"lineItems\\":[],\\"lineItemGroups\\":[],
\\"customerTotal\\":0.00},\\"products\\":[],\\"groupKey\\":0, \\"ignoreCalculate\\": true}"}
Initially I received an error "Unexpected parameter encountered during deserialization: context at [line:1, column:13]"
I then added escapes to the double-quotes around context also.
{\\"context\\":"{\\"quote\\":{\\"record\\":{\\"attributes\\":{\\"type\\":\\"SBQQ__Quote__c\\",\\"url\\":\\"/services/data/v41.0/sobjects/SBQQ__Quote__c/a0p61000004IpR8AAK\\"},
\\"Name\\":\\"Q-00905\\",\\"Id\\":\\"a0p61000004IpR8AAK\\"},\\"nextKey\\":2,\\"netTotal\\":0.00,\\"lineItems\\":[],\\"lineItemGroups\\":[],
\\"customerTotal\\":0.00},\\"products\\":[],\\"groupKey\\":0, \\"ignoreCalculate\\": true}"}
I received the following error. Unexpected character ('' (code 92)): was expecting double-quote to start field name at [line:1, column:3]
I then thought that the values might require double quotes also
{\\"context\\":"{\\"quote\\":{\\"record\\":{\\"attributes\\":{\\"type\\":\\"SBQQ__Quote__c\\",\\"url\\":\\"/services/data/v41.0/sobjects/SBQQ__Quote__c/a0p61000004IpR8AAK\\"},
\\"Name\\":\\"Q-00905\\",\\"Id\\":\\"a0p61000004IpR8AAK\\"},\\"nextKey\\":\\"2\\",\\"netTotal\\":\\"0.00\\",\\"lineItems\\":[],\\"lineItemGroups\\":[],
\\"customerTotal\\":\\"0.00\\"},\\"products\\":[],\\"groupKey\\":\\"0\\", \\"ignoreCalculate\\": \\"true\\"}"}
but the same error occurs.
Does anyone know what format is required to allow this to parse successfully in Apex? Note to get the \'s to appear in this question I had to \\ them :)
Thanks for any help on this. I've been trying out many combinations without success.