REST POST request

1
Does anyone know why I get this error down? Is it up to the party where I want to send a POST request or is something wrong with my configuration (in Postman it works normally)? I tried to send a POST request to another application using the obtained bearer token. I'm attaching screenshots!     Log Node: REST Consume ---  Response content for POST request to http://localhost:60000/api/party/parties/NaturalPerson HTTP/1.1 403 Forbidden Date: Mon, 17 May 2021 10:11:49 GMT Content-Type: application/json; charset=utf-8 Server: Kestrel Content-Length: 4308 {"Message":"Operation is not allowed. User 'Administrator' is not authorized to be actor ''.","Code":"SYS-0244","StackTrace":"   at Adacta.AdInsure.Framework.Core.ApplicationServices.Entities.MasterEntities.Services.MasterEntityServiceBase`1.CheckIfUserIsAuthorizedToBeActor(String configurationCodeName) in /builds/AdInsure/mono/server/Product/Framework/Core.ApplicationServices/Entities/MasterEntities/Services/MasterEntityServiceBase.cs:line 723\n   at Adacta.AdInsure.Framework.Core.ApplicationServices.Entities.MasterEntities.Services.MasterEntityServiceBase`1.CreateMasterEntity(IMasterEntityConfiguration masterEntityConfiguration, CreateMasterEntityRequest request, Boolean checkDuplicates) in /builds/AdInsure/mono/server/Product/Framework/Core.ApplicationServices/Entities/MasterEntities/Services/MasterEntityServiceBase.cs:line 452\n   at Adacta.AdInsure.Framework.Core.ApplicationServices.Entities.MasterEntities.Services.MasterEntityWithSubtypeService`1.CreateMasterEntity(String configurationCodeName, CreateMasterEntityRequest request, Boolean checkDuplicates) in /builds/AdInsure/mono/server/Product/Framework/Core.ApplicationServices/Entities/MasterEntities/Services/MasterEntityWithSubtypeService.cs:line 72\n   at Ninject.Extensions.Interception.Invocation.InvocationBase.Proceed()\n   at Adacta.AdInsure.Framework.Core.Data.Transactions.TransactionInterceptor.Intercept(IInvocation invocation) in /builds/AdInsure/mono/server/Product/Framework/Core.Data/Transactions/TransactionInterceptor.cs:line 39\n   at Ninject.Extensions.Interception.Wrapper.DynamicProxyWrapper.Intercept(IInvocation castleInvocation)\n   at Castle.DynamicProxy.AbstractInvocation.Proceed()\n   at Castle.Proxies.IPartyServiceProxy.CreateMasterEntity(String configurationCodeName, CreateMasterEntityRequest request, Boolean checkDuplicates)\n   at Adacta.AdInsure.Framework.Core.Web.API.Entities.MasterEntities.MasterEntityWithSubtypeControllerBase`1.CreateMasterEntity(String configurationCodeName, CreateMasterEntityRequest request, Boolean checkDuplicates) in /builds/AdInsure/mono/server/Product/Framework/Core.Web.API.NetStd/Entities/MasterEntities/MasterEntityWithSubtypeControllerBase.cs:line 61\n   at Adacta.AdInsure.Framework.Core.Web.API.Entities.AuditTrail.MasterEntities.MasterEntityWithSubtypeAuditLoggingControllerBase`1.CreateMasterEntity(String configurationCodeName, CreateMasterEntityRequest request, Boolean checkDuplicates) in /builds/AdInsure/mono/server/Product/Framework/Core.Web.API.NetStd/Entities/AuditTrail/MasterEntities/MasterEntityWithSubtypeAuditLoggingControllerBase.cs:line 78\n   at Adacta.AdInsure.Party.WebAPI.Public.Party.PartyController.CreateMasterEntity(String configurationCodeName, CreateMasterEntityRequest request, Boolean checkDuplicates) in /builds/AdInsure/mono/server/Product/Business/Shared/Party/WebAPI/Party/PartyController.cs:line 139\n   at lambda_method838(Closure , Object , Object[] )\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()\n--- End of stack trace from previous location ---\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\n--- End of stack trace from previous location ---\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)","ExceptionType":"Adacta.AdInsure.Framework.Core.Authorization.ForbiddenException","IncidentId":"5c28e8bb-9f6d-4056-b6c2-a1defb6099e3","Errors":null,"EntityData":null}     EDITED:  Rest Consume: Server: Kestrel Content-Length: 3761 {"Message":"Service operation error: Property 'masterEntity' is not a JSON object or array but a 'Null'.","Code":null,"StackTrace":"   at Adacta.AdInsure.Framework.Core.Common.JsonObject.GetJsonPropertyAsObject(String propertyName) in /builds/AdInsure/mono/server/Product/Framework/Core/Common/JsonObject.cs:line 236\n   at Adacta.AdInsure.Framework.Core.Domain.Entities.MasterEntities.Services.MasterEntityDomainServiceBase`1.EvaluateMasterEntity(TEntity masterEntity, String evaluationFunctionName, IEnumerable`1 enrichFieldsJPointers) in /builds/AdInsure/mono/server/Product/Framework/Core.Domain/Entities/MasterEntities/Services/MasterEntityDomainServiceBase.cs:line 427\n   at Adacta.AdInsure.Framework.Core.Domain.Entities.MasterEntities.Services.MasterEntityDomainServiceBase`1.EvaluateAndCreate(IMasterEntityConfiguration configuration, String code, Nullable`1 parentId, JsonObject body, IEnumerable`1 enrichFields, Boolean checkDuplicates) in /builds/AdInsure/mono/server/Product/Framework/Core.Domain/Entities/MasterEntities/Services/MasterEntityDomainServiceBase.cs:line 267\n   at Adacta.AdInsure.Framework.Core.ApplicationServices.Entities.MasterEntities.Services.MasterEntityServiceBase`1.CreateMasterEntity(IMasterEntityConfiguration masterEntityConfiguration, CreateMasterEntityRequest request, Boolean checkDuplicates) in /builds/AdInsure/mono/server/Product/Framework/Core.ApplicationServices/Entities/MasterEntities/Services/MasterEntityServiceBase.cs:line 456\n   at Ninject.Extensions.Interception.Invocation.InvocationBase.Proceed()\n   at Adacta.AdInsure.Framework.Core.Data.Transactions.TransactionInterceptor.Intercept(IInvocation invocation) in /builds/AdInsure/mono/server/Product/Framework/Core.Data/Transactions/TransactionInterceptor.cs:line 50\n   at Ninject.Extensions.Interception.Wrapper.DynamicProxyWrapper.Intercept(IInvocation castleInvocation)\n   at Castle.DynamicProxy.AbstractInvocation.Proceed()\n   at Castle.Proxies.IPartyServiceProxy.CreateMasterEntity(String configurationCodeName, CreateMasterEntityRequest request, Boolean checkDuplicates)\n   at Adacta.AdInsure.Party.WebAPI.Public.Party.PartyController.CreateMasterEntity(String configurationCodeName, CreateMasterEntityRequest request, Boolean checkDuplicates) in /builds/AdInsure/mono/server/Product/Business/Shared/Party/WebAPI/Party/PartyController.cs:line 143\n   at lambda_method838(Closure , Object , Object[] )\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()\n--- End of stack trace from previous location ---\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\n--- End of stack trace from previous location ---\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)","ExceptionType":"System.InvalidOperationException","IncidentId":"69fb0577-4a5b-4c18-b4ce-c184eae3ad24","Errors":null,"EntityData":null}      
asked
2 answers
2

The local service you are posting to is returning a 403 forbidden status. This probably means your bearer token is not correct or invalid.

I did also notice the body of your POST request appeared to be empty. Is that correct.

Good luck!

answered
1

You are sending this to your own localhost according to the error. You might want to check the URL of this service if this is an external service.

Regards,

Ronald

 

answered