I can update synonyms list using the REST call
curl -X POST -H 'Content-type:application/json' --data-binary '["angry","upset"]' "http://localhost:8983/solr/articles/schema/analysis/synonyms/english"
How to send same request using SolrJ?
Please try something like below.
SolrClient solrClient = new HttpSolrClient("http://localhost:8983/solr/my_collection");
ContentStreamBase.StringStream contentStream = new ContentStreamBase.StringStream(jsonBody);
contentStream.setContentType(JSON_CONTENT_TYPE);
ContentStreamUpdateRequest req = new ContentStreamUpdateRequest(updatePath);
req.addContentStream(contentStream);
return solrClient.request(req);
Note : Good Practice is send the solrClient object to the method.