Skip to content

Umbraco HTTP client possible missing documentation #7314

@DemeSzabolcs

Description

@DemeSzabolcs

What type of issue is it?

Missing documentation

What article/section is this about?

Umbraco HTTP client or Creating a backoffice API

Describe the issue

Documentation says:

You can use it to make requests to any endpoint in the Management API or to any other API.

I tried doing exactly that in my package, in a ts file:

 async firstUpdated() {

        const response = await tryExecute(this, umbHttpClient.get<ContentType[]>({
            url: '/umbraco/management/api/v1/content-insights/get-content-types',
        }));

This is my controller action that I try to call:

[VersionedApiBackOfficeRoute("content-insights")]
[ApiExplorerSettings(GroupName = "Content Insights API")]
public class ContentInsightsController : ManagementApiControllerBase
{
    private readonly IContentTypeService _contentTypeService;

    public ContentInsightsController(IContentTypeService contentTypeService) =>
        _contentTypeService = contentTypeService;

    [HttpGet("get-content-types")]
    public IActionResult GetContentTypes()
    {
        var types = _contentTypeService.GetAll()
            .Select(ct => new
            {
                ct.Alias,
                ct.Name
            });

        return Ok(types);
    }
}

Everything seems fine; however, when the ts file loads on a page, it logs me out with a session timeout. When I log in, it does the same thing again over and over. This is caused by the request that I make with the HTTP client.

Related forum post: https://forum.umbraco.com/t/calling-controller-action-results-in-session-timeout/5145/2

I tried everything, but it logs me out. I think something is missing from the documentation, either in Umbraco HTTP client or in Creating a backoffice API, to make this possible, without the session timeout problem.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions