Expose an API in my extension

53 views
Skip to first unread message

John

unread,
Apr 17, 2015, 6:11:50 AM4/17/15
to chromium-...@chromium.org
Hello,

I want to build an extension that is able expose an API that can be queried ideally via HTTP, is that possible?


I got as far as being able to do requests to chrome-extension://extensionString/api.html?[params here]

However, I can only query it through chromium, an external process can not request that path and read the response. Obviously, that is not the right approach.


I could not find information about it by reading the chrome extension documentation, could someone point me out a reference?

Many Thanks,

Antony Sargent

unread,
Apr 21, 2015, 8:00:48 PM4/21/15
to John, Chromium-extensions
You can't do this directly in an extension, but could in an app using the tcp sockets API: https://developer.chrome.com/apps/sockets_tcp

A workaround for doing it in an extension would be to write a proxy chrome app (or native app) that uses cross-extension messaging (or native messaging) to forward the communication to and from your extension. 



--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/ea52bf39-9142-48b5-b5bf-5d85b45cd3a8%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.

John

unread,
Apr 22, 2015, 5:21:48 AM4/22/15
to chromium-...@chromium.org, zati...@gmail.com
Thanks Antony for your reply.

Looks like the cleanest approach is to migrate the extension to an app, will do that.


Regards.


El miércoles, 22 de abril de 2015, 1:00:48 (UTC+1), Antony Sargent escribió:
You can't do this directly in an extension, but could in an app using the tcp sockets API: https://developer.chrome.com/apps/sockets_tcp

A workaround for doing it in an extension would be to write a proxy chrome app (or native app) that uses cross-extension messaging (or native messaging) to forward the communication to and from your extension. 


On Fri, Apr 17, 2015 at 3:11 AM, John <zati...@gmail.com> wrote:
Hello,

I want to build an extension that is able expose an API that can be queried ideally via HTTP, is that possible?


I got as far as being able to do requests to chrome-extension://extensionString/api.html?[params here]

However, I can only query it through chromium, an external process can not request that path and read the response. Obviously, that is not the right approach.


I could not find information about it by reading the chrome extension documentation, could someone point me out a reference?

Many Thanks,

--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.
Reply all
Reply to author
Forward
0 new messages