Setting favicon

Hey guys,

the docs are very limited when it comes to setting a favicon, all information I get is it must be a string. No matter what I am trying I always get ā€œid wasnā€™t suppliedā€. Iā€™ve created an upload first and then used the uploadā€™s id to set the favicon. Everything is fine with my upload as itā€™s no problem to insert it into a record.

{"data":[{"id":"7f64f8","type":"api_error","attributes":{"code":"INVALID_FORMAT","details":{"messages":["#/data: failed schema #/definitions/site/links/1/schema/properties/data: \"id\" wasn't supplied."]}}}]}

Same error when I try to pass an object with an id.

Do you have an idea? Is there any difference when uploading a favicon?

Hello @marc nice to see you again :slight_smile:

Can you please share some example code so that we can get a better idea of what you are trying to do? Thanks!

Hey @mat_jack1 , thanks :smiley: I saw you added some nice new tools, especially the environments :slight_smile: was busy with other stuff but I am going on with my Dato project now.

I already removed my code as I had to go on but it was something like this:

const faviconPath = await client.createUploadPath(path.join(__dirname, "./uploads/favicon.jpg"));
const favicon = await client.uploads.create({
  path: faviconPath,
  copyright: "Foo",
  defaultFieldMetadata: {
    en: {
      alt: "Foo",
      title: "Bar",
      customData: {}
    },
  },
});

await client.site.update({
    favicon: favicon.id,
});

Do you probably have to provide a png or ico?

Iā€™ve found the issue, you also need to pass as an additional attribute your site id as : id.

From the documentation it shouldnā€™t be the case. Iā€™m going to check if itā€™s a bug or if we need to amend the docs. Iā€™ll be in touch!

Hey @marc! We just dropped the requirement on the ID since itā€™s redundant!

thanks a lot @s.verna and @mat_jack1!