# Gzipped http post support

**URL:** <https://community.stardog.com/t/gzipped-http-post-support/844>\
**Category:** Support\
**Created:** [March 2, 2018, 2:44pm UTC](https://community.stardog.com/t/gzipped-http-post-support/844 "2018-03-02T14:44:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![signalfrax](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@signalfrax](https://community.stardog.com/u/signalfrax)\
**Post date:** [March 2, 2018, 2:44pm UTC](https://community.stardog.com/t/gzipped-http-post-support/844/1 "2018-03-02T14:44:52Z")

</div>

Does Stardog 5.0.3 support gzipped POST requests?  
I’m trying to load data with “Content-Encoding: gzip” without success.

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [March 2, 2018, 4:01pm UTC](https://community.stardog.com/t/gzipped-http-post-support/844/2 "2018-03-02T16:01:20Z")

</div>

What behavior are you seeing? Are there errors in your stardog.log?

---

<div class="post-metadata">

**Author:** ![signalfrax](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@signalfrax](https://community.stardog.com/u/signalfrax)\
**Post date:** [March 5, 2018, 11:14am UTC](https://community.stardog.com/t/gzipped-http-post-support/844/3 "2018-03-05T11:14:34Z")

</div>

Hi Stephen,

I'm getting a 400 with message "{"message":"Lexical error at line 1, column 1. Encountered: "31" (31), after : ""","code":"MalformedQuery"}" for this request **WITH** Content-Encoding: gzip. Without gzip encoding the request returns 200.

POST [http://localhost:5820/base\_testing/update](http://localhost:5820/base_testing/update) HTTP/1.1  
Content-type: application/sparql-update  
Content-encoding: gzip

INSERT DATA {  
GRAPH { \<[http://xmlns.com/foaf/0.1/123\](http://xmlns.com/foaf/0.1/123%5C)\> \<[http://www.w3.org/2000/01/rdf-schema#type\](http://www.w3.org/2000/01/rdf-schema#type%5C)\> \<[http://xmlns.com/foaf/0.1/person\](http://xmlns.com/foaf/0.1/person%5C)\> }}

Server log:

ERROR 2018-03-05 11:56:26,929 [XNIO-1 task-4] com.complexible.stardog.protocols.http.server.StardogHttpServiceLoader:accept(223): An exception was handled by the server: Lexical error at line 1, column 1. Encountered: "31" (31), after : ""

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [March 5, 2018, 9:03pm UTC](https://community.stardog.com/t/gzipped-http-post-support/844/4 "2018-03-05T21:03:43Z")

</div>

I’m not sure why without gzip it returns 200, as the query is malformed. You have the `GRAPH` keyword, however there’s no graph specified. You either need to specify a graph:

```auto
INSERT DATA { GRAPH <http://my.graph/> { <urn:x> <urn:y> <urn:z> } }

```

or remove the keyword:

```auto
INSERT DATA { <urn:x> <urn:y> <urn:z> }

```

---

<div class="post-metadata">

**Author:** ![signalfrax](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@signalfrax](https://community.stardog.com/u/signalfrax)\
**Post date:** [March 6, 2018, 10:16am UTC](https://community.stardog.com/t/gzipped-http-post-support/844/5 "2018-03-06T10:16:48Z")

</div>

I removed the empty graph and I’m getting the same error. It seems as if it’s not unzipping the request before performing the query. Just a general question is stardog 5.0.3 supposed to handle encoded gzip post request?

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [March 6, 2018, 1:43pm UTC](https://community.stardog.com/t/gzipped-http-post-support/844/6 "2018-03-06T13:43:21Z")

</div>

Yes, the server is supposed to handle gzip-encoding, however upon further examination it does appear that it’s only handling it for RDF data payloads, and not for SPARQL queries. Do you have a use case that would require a gzipped query to be sent?

---

<div class="post-metadata">

**Author:** ![signalfrax](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@signalfrax](https://community.stardog.com/u/signalfrax)\
**Post date:** [March 7, 2018, 8:16am UTC](https://community.stardog.com/t/gzipped-http-post-support/844/7 "2018-03-07T08:16:44Z")

</div>

I would like to send an INSERT DATA query of 200k triples to Stardog using a standard SPARQL client. I know that I can use the Stardog client for this but it would mean that I will have to package the client together with the application. Will gzip-encoding for SPARQL queries be supported in the future?

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [March 7, 2018, 2:02pm UTC](https://community.stardog.com/t/gzipped-http-post-support/844/8 "2018-03-07T14:02:15Z")

</div>

We will continue to look into supporting gzip for queries, however there are more efficient ways available to you right now that DO accept gzipped data. You can use either our [HTTP API](https://stardog.docs.apiary.io/#reference/transactions/adding-data-to-a-transaction/post) or the [SPARQL Graph Store Protocol](https://www.w3.org/TR/sparql11-http-rdf-update/) to bulk add RDF data to your db.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [March 21, 2018, 2:10pm UTC](https://community.stardog.com/t/gzipped-http-post-support/844/9 "2018-03-21T14:10:55Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
