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!