# Work with result from a http get

**URL:** <https://discourse.mozilla.org/t/work-with-result-from-a-http-get/72586>\
**Category:** Development\
**Created:** [December 22, 2020, 10:57am UTC](https://discourse.mozilla.org/t/work-with-result-from-a-http-get/72586 "2020-12-22T10:57:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcus\_Stricker](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/marcus_stricker/32/43477_2.png) [@Marcus\_Stricker](https://discourse.mozilla.org/u/Marcus_Stricker)\
**Post date:** [December 22, 2020, 10:57am UTC](https://discourse.mozilla.org/t/work-with-result-from-a-http-get/72586/1 "2020-12-22T10:57:50Z")

</div>

hello all  
i´m new in addon development.  
i try my first steps.  
now i have my first question

i would like to get data out of a http get response and save it in storage local.

i check if it is the right web request  
with this code

function logURL(requestDetails) {

if ( requestDetails.url.substring(0,33) ==‘[https://www.website.com/data/json](https://www.website.com/data/json)’ ) {  
console.log("found: " + requestDetails.url);  
}  
}

browser.webRequest.onBeforeRequest.addListener(  
logURL,  
{urls: ["\<all\_urls\>"]}  
);

but how can i access the result from this get  
it is a json format

thanks br marcus

---

<div class="post-metadata">

**Author:** ![jscher2000](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/jscher2000/32/28202_2.png) [@jscher2000](https://discourse.mozilla.org/u/jscher2000)\
**Post date:** [December 22, 2020, 4:48pm UTC](https://discourse.mozilla.org/t/work-with-result-from-a-http-get/72586/2 "2020-12-22T16:48:51Z")

</div>

Hi, the server’s response is not yet available in onBeforeRequest, you need to listen for a later event.

---

<div class="post-metadata">

**Author:** ![Marcus\_Stricker](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/marcus_stricker/32/43477_2.png) [@Marcus\_Stricker](https://discourse.mozilla.org/u/Marcus_Stricker)\
**Post date:** [December 26, 2020, 12:28am UTC](https://discourse.mozilla.org/t/work-with-result-from-a-http-get/72586/3 "2020-12-26T00:28:31Z")

</div>

Thanks for your answer.  
i´m relative new in this development.  
can you give me some hints oder a codefragment where i can see how i can access the data marked on the picture ?

thanks a lot

br caddy

 ![Unbenannt](https://us1.discourse-cdn.com/flex001/uploads/mozilla/original/3X/f/b/fbc11aa76cde6316a8a9e5673f1673933775882c.png)

---

<div class="post-metadata">

**Author:** ![jscher2000](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/jscher2000/32/28202_2.png) [@jscher2000](https://discourse.mozilla.org/u/jscher2000)\
**Post date:** [December 26, 2020, 1:35am UTC](https://discourse.mozilla.org/t/work-with-result-from-a-http-get/72586/4 "2020-12-26T01:35:35Z")

</div>

This is a request made by the page? I don’t know how you access the body of the response, I’ve only worked with the headers.

Looks like you need to set up one of these:

[https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/StreamFilter](https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/StreamFilter)

---

<div class="post-metadata">

**Author:** ![Marcus\_Stricker](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/marcus_stricker/32/43477_2.png) [@Marcus\_Stricker](https://discourse.mozilla.org/u/Marcus_Stricker)\
**Post date:** [December 26, 2020, 10:54am UTC](https://discourse.mozilla.org/t/work-with-result-from-a-http-get/72586/5 "2020-12-26T10:54:53Z")

</div>

great, i will have a look in it thanks

br caddy

---

<div class="post-metadata">

**Author:** ![Marcus\_Stricker](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/marcus_stricker/32/43477_2.png) [@Marcus\_Stricker](https://discourse.mozilla.org/u/Marcus_Stricker)\
**Post date:** [January 13, 2021, 5:04pm UTC](https://discourse.mozilla.org/t/work-with-result-from-a-http-get/72586/6 "2021-01-13T17:04:34Z")

</div>

thanks a lot. my addon is running.
