Skip to content

Management API PageSave returns 500 "Exception has been thrown by the target of an invocation" for an unknown publicationState instead of a validation error #701

Description

@Justinvolved

Describe the bug

PageSave with a publicationState value that is not a member of PublishingMode (Published, Unpublished, HideInMenu) fails with HTTP 500 and the generic text "Exception has been thrown by the target of an invocation." The response does not say which field is wrong or which values are valid. GetPageById returns the value in lower case ("published"), and the valid value for hiding a page from menus is HideInMenu, which is easy to guess wrong (Hidden).

To Reproduce

  1. GET /Admin/Api/GetPageById?Id=<page id>. Keep the model.
  2. POST /Admin/Api/PageSave with that model and "publicationState":"Hidden".
  3. Read the page row again.

Observed (DW 10.28.11):

GetPageById -> "publicationState":"published", "published":false
PageSave {"model":{..., "publicationState":"Hidden"}}
  -> HTTP 500 {"type":"https://tools.ietf.org/html/rfc9110#section-15.6.1",
     "title":"Exception has been thrown by the target of an invocation.","status":500}
Page row unchanged.

On 10.28.10 "hidden" gave the same 500 and "Unpublished" saved.

Expected behavior

HTTP 400 with a validation message that names the field and the valid values, for example publicationState: 'Hidden' is not valid. Valid values: Published, Unpublished, HideInMenu.

Environment

  • Dynamicweb 10.28.11 (.NET 10 hosting)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingContentFor items related to Content

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions