figma-plugin
figma-plugin copied to clipboard
[URL sync] Support sending a POST request
Hi there and thanks for all ya hard work,
we want to use your URL Provider plugin which is atm READONLY. https://github.com/six7/figma-tokens/blob/a806b12a3b5ada8c4da33e5c5db6eb17f122702b/src/app/store/providers/url.tsx
We figure out that this works with our in house VPN like a charm and therefore no github or jsonbin is necessary. Because we cant use cloud services.
Is It possible to add and export POST request to another URL? So we can build our own in house json storage?
Cheers and thanks in advance.
I would say this should be possible! I'm not sure what would be required, but I guess it would be split up into GET URL and POST URL. GET is required, POST is optional.
Is there anything else that you think would be required to make this work? Additional headers only on POST, or can these reuse what GET is using?
It should be simple as this code sample:
await fetch(postUrl, {
method: 'post',
headers: {
'Content-type': 'application/json'
},
body: JSON.stringify({
tokens
}),
});
yes a split up in GET and POST is useful. GET and POST can have be different URL's but due the different METHOD it could be the same. is the URL stored in LocalStorage?
cheers and thanks for the fast reply.
It would be great to also have an ability to edit headers. The use case is to trigger remote API to process payload. My current use case would be to trigger GitHub action. I don't want to create PR directly in plugin but to do some processing beforehand and automate PR naming, and it's description.
I'd love to see this so we can create our own integration to secure our repo credentials
Closing this as we technically have support for this via Generic Versioned Storage which is like a better URL sync. https://docs.tokens.studio/sync/generic-storage