Image URLs in plug-ins

Question #1
My plugin contains several images in addition to images/icon.png. If you do a view source on the plugin configuration page, this is the form of the URL used to reference icon.png:

https://mydomain.cybozu.com/k/api/dev/plugin/content/downloadIcon.do?contentId=5082&size=NORMAL&pluginId=xxxxxxxx

But if I have extra files in the images folder, what URL would I use to display them?

Question #2
From a plugin, how can I access the icon for an app given its appId? If you inspect the home page with the Chrome debugger, this is the URL used to reference the app icon for appId=94:

/k/api/app/icon.do/-/app.png?app=94&size=NORMAL&hash=32df4f52d2dc7fe39559010c6bed482779010e25&.png

But without the hash argument, you get a 403 forbidden error, and I have no way of knowing what the hash argument should be.

John, I’m also finding this tricky too.

>>Question #1
I’ve replicated a similar environment, and tried to reference other image files in the folder, but I too could not find a way to point to those data sources :frowning:
I’m not sure if there’s a way around this - what were you planning to do if you were able to point to the images?

>>Question #2
For the moment, there doesn’t seem to be a good practice for accessing those icon images. The hash parameter could change at any time (not exactly sure when that timing would be - for example, on a kintone update).
It seems better if you could keep the images on a different data-source (for example, on Dropbox, or on a homepage), and to reference that source.

Akira,

Thank you for your reply. For #1, I can put the images on a separate server such as Dropbox. I’d prefer to put everything in one place (plugin.zip) and access it from there, but this is an acceptable workaround.

For #2, I’m writing a plugin to access data from multiple unrelated apps. I can use the /k/v1/apps API to get a list of app names and ids, but this does not return the icon URL. There is no loss of functionality, but it would be helpful for the user to see the app icons along with the names before making selections. Note that unlike the situation in #1, I don’t own the app icons (which may change), so Dropbox is not an option here.

Hi John.

you can get image fileKey with using this API(/k/v1/preview/app/settings.json)
but there seems to be only in JP developer network.

https://cybozudev.zendesk.com/hc/ja/articles/204694170

As for PRESET Icons, you can get these image files on Apps Appearance.

I can get the fileKey using the settings.json API, but this is not the same as the hash value and does not work in the above URL. The hash value is 40 digits; the fileKey is 49 digits, with the first 8 being a time stamp YYYYMMDD.

You can use fileKey by using this API(/k/v1/file.json).
https://developer.kintone.io/hc/en-us/articles/212494468/

I can download app Icon by using this code:) Could you check it?

//input your fileKey by using (/k/v1/preview/app/settings.json)
var fileKey = “XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”;
var url = ‘https://{subdomain}.kintone.com/k/v1/file.json?fileKey=’ + fileKey;
window.location.href = url;

I am creating <img> tags dynamically and was trying to specify a static URL in the src attribute using the fileKey. But now I see that I need to make another API call (/k/v1/file.json), then convert the response to a base64 string, then use that as the src attribute.

For preset icons, there is no way that I know of to translate a key such as APP39 into an image URL, so I suppose I’ll have to make my own lookup table for the known values.

>But now I see that I need to make another API call (/k/v1/file.json), then convert the response to a base64 string, then use that as the src attribute.

That’s cool:) and for preset icons, I think so.

Hi John.

Have you found a way for the acquisition of URL?