I am testing the Micro focus Content Manager 23.4 in the dev environment using CMServiceAPI , all the GET functions work fine, however all the POST function get 403 error: Could not deserialize request.
eg. Delete a record:
curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'DeleteRecordDeleteContents=true' 'http://servername/CMServiceAPI/Record/1/Delete'
checking the server log, see this error: 2024-02-20 18:19:07,861 [40] ERROR HP.HPTRIM.Service.TrimAppHost - The required anti-forgery cookie "__RequestVerificationToken_L0NNU2VydmljZUFQSQ2" is not present. ServiceStack.HttpError: The required anti-forgery cookie "__RequestVerificationToken_L0NNU2VydmljZUFQSQ2" is not present. at HP.HPTRIM.Service.ValidateHttpAntiForgeryToken.Execute(IRequest req, IResponse res, Object requestDto) at HP.HPTRIM.Service.ValidateHttpAntiForgeryToken.RequestFilter(IRequest req, IResponse res, Object requestDto) at ServiceStack.ServiceStackHost.d__435.MoveNext() in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/ServiceStackHost.Runtime.cs:line 230 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at ServiceStack.ServiceStackHost.d__434.MoveNext() in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/ServiceStackHost.Runtime.cs:line 144 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at ServiceStack.Host.RestHandler.d__14.MoveNext() in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/Host/RestHandler.cs:line 93
BTW, create record, delete record works fine in Content Manager GUI.
Did I miss anything in CMServiceAPI configuration?
Any suggestions really appreciate.
The error is the Anti Forgery token was not present in your CURL requests, whereas they would be sent in your UI.