Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Diego 25 posts 156 karma points
    Sep 12, 2023 @ 12:15
    Diego
    0

    Umbraco Cloud: Rest API return html rather than json

    Hello everyone, I would like to bring an issue. It concerns calls that i make to an API Controller that i created, having had the need to create customized tables in the database. I would like to say that locally everything works while in the cloud, when we make a GET call (for example) the server gives us as a response 200 (ok), it does not return a json (with a list of an objects) but an HTML page.

    I also tested the call with Postman and sever answer with 200 code but have an html rather than json.

    enter image description here

    Someone can tell me why? Is some special setting required?

    (In browser settings i don't block the javascript)

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Sep 13, 2023 @ 12:41
    Sebastiaan Janssen
    0

    You've tagged this with Umbraco Heartcore, is that what you are using? As far as I know you can't make custom code or a local copy with Heartcore so I'm not sure how you managed that.

    In any case, it looks like your API or the remote site requires authentication so you'd need to send that into your request.

    But really, I haven't seen this message before so without knowing a bit more about your setup it's a bit of a guess.

  • Diego 25 posts 156 karma points
    Sep 13, 2023 @ 17:34
    Diego
    0

    Hi Sebastiaan, no i using Umbraco Cloud not HeartCore. Wasn't possible select Cloud when i created this post.

    I'm new in Umbraco and in local project (Umbraco Cms 12) all work fine. But when i transfered all in Cloud, several problems occurred. For exemple:

    • I created some custom tables to manage some member's data, but when i doing a call on an UmbracoApiController to get that data (GET), on cloud doesn't work. The project is on protected default domain provided to Umbraco.

    I tested the call also with Postman, and i get like result an html rather than json to desirialize. Seem it's necessary to be logged in to do the calls, but have no sense. Not even the member when is logged in can do that call... I repeat, local project work fine and doing the calls very well.

    Thanks in advance for the help.

    Best regards

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Sep 14, 2023 @ 12:27
    Sebastiaan Janssen
    0

    Yeah I'm sorry, I don't know either.. you need to get that project to not be protected or send authorization headers, but I wouldn't have a clue which ones you could send.

Please Sign in or register to post replies

Write your reply to:

Draft