Open Closed

Swagger API CreateorEdit on powertool generated code #7134


0
rrader26 created

Hello, I am using the PowerTool code generator, all compiles fine and the database is created. However, when I go to insert a record using the swagger UI. I am getting the following error. Thought to what i could be?

{ "result": null, "targetUrl": null, "success": false, "error": { "code": 0, "message": "An internal error occurred during your request!", "details": null, "validationErrors": null }, "unAuthorizedRequest": false, "__abp": true }

Here is the tcClients.Client.json file which the generator uses

{ "IsRegenerate": true, "MenuPosition": "main", "RelativeNamespace": "TcClients", "EntityName": "Client", "EntityNamePlural": "Clients", "TableName": "Clients", "PrimaryKeyType": "long", "BaseClass": "Entity", "EntityHistory": true, "AutoMigration": true, "UpdateDatabase": true, "CreateUserInterface": true, "CreateViewOnly": true, "CreateExcelExport": true, "PagePermission": { "Host": true, "Tenant": true }, "Properties": [ { "Name": "FirstName", "Type": "string", "MaxLength": 50, "MinLength": 2, "Range": { "IsRangeSet": false, "MinimumValue": 0, "MaximumValue": 0 }, "Required": true, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true } }, { "Name": "LastName", "Type": "string", "MaxLength": 50, "MinLength": 2, "Range": { "IsRangeSet": false, "MinimumValue": 0, "MaximumValue": 0 }, "Required": true, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true } }, { "Name": "EmailAddress", "Type": "string", "MaxLength": 100, "MinLength": 1, "Range": { "IsRangeSet": false, "MinimumValue": 0, "MaximumValue": 0 }, "Required": true, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true } }, { "Name": "PhoneNumber", "Type": "string", "MaxLength": 20, "MinLength": 10, "Range": { "IsRangeSet": false, "MinimumValue": 0, "MaximumValue": 0 }, "Required": true, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true } }, { "Name": "Billable_Address", "Type": "string", "MaxLength": 100, "MinLength": 1, "Range": { "IsRangeSet": false, "MinimumValue": 0, "MaximumValue": 0 }, "Required": true, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true } }, { "Name": "Billable_Address2", "Type": "string", "MaxLength": 100, "MinLength": 0, "Range": { "IsRangeSet": false, "MinimumValue": 0, "MaximumValue": 0 }, "Required": false, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true } }, { "Name": "Billable_City", "Type": "string", "MaxLength": 50, "MinLength": 1, "Range": { "IsRangeSet": false, "MinimumValue": 0, "MaximumValue": 0 }, "Required": true, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true } }, { "Name": "Billable_State", "Type": "string", "MaxLength": 2, "MinLength": 2, "Range": { "IsRangeSet": false, "MinimumValue": 0, "MaximumValue": 0 }, "Required": true, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true } }, { "Name": "Billable_Zip", "Type": "string", "MaxLength": 10, "MinLength": 5, "Range": { "IsRangeSet": false, "MinimumValue": 0, "MaximumValue": 0 }, "Required": true, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true } }, { "Name": "Soldto_Address", "Type": "string", "MaxLength": 100, "MinLength": 1, "Range": { "IsRangeSet": false, "MinimumValue": 0, "MaximumValue": 0 }, "Required": true, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true } }, { "Name": "Soldto_Address2", "Type": "string", "MaxLength": 100, "MinLength": 0, "Range": { "IsRangeSet": false, "MinimumValue": 0, "MaximumValue": 0 }, "Required": false, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true } }, { "Name": "Soldto_City", "Type": "string", "MaxLength": 50, "MinLength": 1, "Range": { "IsRangeSet": false, "MinimumValue": 0, "MaximumValue": 0 }, "Required": true, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true } }, { "Name": "Soldto_State", "Type": "string", "MaxLength": 2, "MinLength": 2, "Range": { "IsRangeSet": false, "MinimumValue": 0, "MaximumValue": 0 }, "Required": true, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true } }, { "Name": "Soldto_Zip", "Type": "string", "MaxLength": 10, "MinLength": 5, "Range": { "IsRangeSet": false, "MinimumValue": 0, "MaximumValue": 0 }, "Required": true, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true } }, { "Name": "Billable_Country", "Type": "string", "MaxLength": 3, "MinLength": 2, "Range": { "IsRangeSet": false, "MinimumValue": 0, "MaximumValue": 0 }, "Required": true, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true } }, { "Name": "Soldto_Country", "Type": "string", "MaxLength": 3, "MinLength": 2, "Range": { "IsRangeSet": false, "MinimumValue": 0, "MaximumValue": 0 }, "Required": true, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true } } ], "NavigationProperties": [], "EnumDefinitions": [] }

Here is the curl:

curl -X POST "http://localhost:22742/api/services/app/Clients/CreateOrEdit" -H "accept: application/json" -H "Content-Type: application/json-patch+json" -d "{ "firstName": "Ryan", "lastName": "Bader", "emailAddress": "ryan.bader@test.com", "phoneNumber": "555-555-5555", "billable_Address": "9901 Main St", "billable_Address2": "", "billable_City": "Charlotte", "billable_State": "NC", "billable_Zip": "28277", "soldto_Address": "9901 Main St", "soldto_Address2": "", "soldto_City": "Charlotte", "soldto_State": "NC", "soldto_Zip": "28277", "billable_Country": "USA", "soldto_Country": "USA",}"


5 Answer(s)
  • 0
    maliming created

    An internal error occurred during your request!

    Can you look at the error message in the log?

  • 0
    rrader26 created

    where do I check the log? from the console it's not showing any

  • 0
    maliming created

    The log of the application backend is generally in App_Data/Logs/Logs.txt

  • 0
    rrader26 created

    is there a way for the error to get returned/passed to the api so we know the error at time of execution?

  • 0
    maliming created

    try SendAllExceptionsToClients

    ...
    using Abp.Web.Configuration;
    ...
    public override void PreInitialize()
    {
        Configuration.Modules.AbpWebCommon().SendAllExceptionsToClients = true;
    }
    ...