Issue with Changing Default Layout via API

Hi everyone,

I’m encountering an issue while attempting to change the default layout using the Xibo API. I’m utilizing the defaultlayout endpoint with the display ID, as shown below:

{{baseUrl}}/api/display/defaultlayout/21

Interestingly, I can successfully perform this action using Postman. However, when I try the same operation through my web application, it fails to work. Initially, I faced CORS origin issues, which I resolved by implementing a proxy to bypass them.

However, I’m now consistently receiving the following error message:

{
“error”: 404,
“message”: “LayoutId is 0”,
“property”: null,
“help”: null
}

Here are the details of the request:

  • URL: http://172.24.100.46/api/display/defaultlayout/21
  • Request Body: Form Data (view source to see URL-encoded data)
    • layoutId: 125
  • Headers:
    • 'Content-Type': 'application/x-www-form-urlencoded'
    • 'Authorization': 'Bearer ' + accessToken

Has anyone else encountered a similar issue? Any insights into what might be causing this problem would be greatly appreciated.

P.S. The Xibo server is running on a Linux machine, in case that’s relevant.

Thank you for your help and suggestions.

Best regards,

Shaul

NoOne ?! //////////////////////////////

Hello @SakitShoko

Welcome to the Xibo Community :wink:

If it works with postman, there’s no reason why it shouldn’t work with your programme.

What programming language do you use?
Can you paste your code?

On posman, you can use this function to give you an idea of the code to insert.

Hi ProServ,

Thank you for the greetings and your time and efforts. :blush:

I’m using JavaScript with Express and Node.js. I managed to solve the issue—the problem was that I needed to pass the header application/json instead of application/x-www-form-urlencoded.

Regards