# How I can use :8080/admin/export with TLS

**URL:** <https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062>\
**Category:** Dgraph\
**Created:** [March 2, 2020, 7:45pm UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062 "2020-03-02T19:45:59Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![vladimir](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/vladimir/32/972_2.png) [@vladimir](https://discuss.dgraph.io/u/vladimir)\
**Post date:** [March 2, 2020, 7:46pm UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062/1 "2020-03-02T19:46:00Z")

</div>

Hello.  
I used the following commands  
gigihont@ubn:~/secure$ **dgraph zero --my=192.168.1.97:5080 -w zeroSingle | tee -a Zero\_output.txt**  
[Decoder]: Using assembly version of decoder  
I0302 14:08:17.858770 1726 init.go:98]

Dgraph version : v2.0.0-rc1  
Dgraph SHA-256 : 447ca408b0e56702568f25ceab89eb712090f5f19f06752b70b9a28ca1260cd6  
Commit SHA-1 : a4af81a36  
Commit timestamp : 2020-02-14 17:05:06 -0800  
Branch : HEAD  
Go version : go1.13.7

dgraph alpha --whitelist=192.168.1.117 --tls\_client\_auth VERIFYIFGIVEN --my=192.168.1.97:7080 --l  
ru\_mb=3512 --zero=192.168.1.97:5080 --tls\_dir tls -p serverS/p -w serverS/w -o 0 | tee -a Server\_output.txt

dgraph-ratel -tls\_crt ./tls/node.crt -tls\_key ./tls/node.key

 ![Снимок экрана (14)](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/8/8797a4fd4f708e624295c17f6d1bd4c1fbb3b021.png)

When I try to type a command in the browser’s search bar, I see this

 ![Снимок экрана (16)](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/7/7e46a836156d05b6278351295c16f601cd35f033.png)

When I try to do an export using curl, I get an error

```auto
gigihont@ubn:~/secure$ curl 'https://192.168.1.97:8080/admin/export?format=json'
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

```

**I’m trying with a certificate**

```auto
gigihont@ubn:~/secure$ curl https://192.168.1.97:8080/admin/export?format=json --cert ./tls/client.user.crt --key ./tls/client.user.key
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

```

**I see errors in dgraph alpha instatce**

```auto
I0302 18:59:03.857561 2731 groups.go:864] Got Zero leader: 192.168.1.97:5080
I0302 18:59:05.803604 2731 admin.go:391] No GraphQL schema in Dgraph; serving empty GraphQL API
2020/03/02 19:01:04 http: TLS handshake error from 192.168.1.97:42074: remote error: tls: unknown certificate authority
2020/03/02 19:03:41 http: TLS handshake error from 192.168.1.97:42076: remote error: tls: unknown certificate authority
2020/03/02 19:17:33 http: TLS handshake error from 192.168.1.97:42080: remote error: tls: unknown certificate authority

```

Tell me what I’m doing wrong.

---

<div class="post-metadata">

**Author:** ![vladimir](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/vladimir/32/972_2.png) [@vladimir](https://discuss.dgraph.io/u/vladimir)\
**Post date:** [March 2, 2020, 9:16pm UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062/2 "2020-03-02T21:16:19Z")

</div>

Hello.  
I tried making this command but didn’t get the export

```auto
gigihont@ubn:~/secure$ curl https://192.168.1.97:8080/admin/export?format=json --cert ./tls/client.user.crt --key ./tls/client.user.key --cacert ./tls/ca.crt
Dgraph browser is available for running separately using the dgraph-ratel binarygigihont@ubn:~/secure$

```

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [March 3, 2020, 1:25am UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062/3 "2020-03-03T01:25:49Z")

</div>

Have you tried the insecure flag?

---

<div class="post-metadata">

**Author:** ![vladimir](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/vladimir/32/972_2.png) [@vladimir](https://discuss.dgraph.io/u/vladimir)\
**Post date:** [March 3, 2020, 5:24am UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062/4 "2020-03-03T05:24:02Z")

</div>

It doesn’t work

```auto
gigihont@ubn:~/secure$ curl 'https://192.168.1.97:8080/admin/export?format=json' --insecure --cert ./tls/client.user.crt --key ./tls/client.user.key --cacert ./tls/ca.crt
Dgraph browser is available for running separately using the dgraph-ratel binarygigihont@ubn:~/secure$

```

```auto
gigihont@ubn:~/secure$ curl '192.168.1.97:8080/admin/export?format=json' --insecure --cert ./tls/client.user.crt --key ./tls/client.user.key --cacert ./tls/ca.crt
Client sent an HTTP request to an HTTPS server.

```

---

<div class="post-metadata">

**Author:** ![vladimir](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/vladimir/32/972_2.png) [@vladimir](https://discuss.dgraph.io/u/vladimir)\
**Post date:** [March 3, 2020, 8:23pm UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062/5 "2020-03-03T20:23:10Z")

</div>

Hello.  
Is this problem with curl?

```auto
gigihont@ubn:~$ curl -V
curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Release-Date: 2018-01-24
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL

```

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [March 3, 2020, 8:58pm UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062/6 "2020-03-03T20:58:27Z")

</div>

Not sure, I’ll check this.

Until there, try with wget [HTTPS (SSL/TLS) Options (GNU Wget 1.21.1-dirty Manual)](https://www.gnu.org/software/wget/manual/html_node/HTTPS-_0028SSL_002fTLS_0029-Options.html)

Cheers.

---

<div class="post-metadata">

**Author:** ![vladimir](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/vladimir/32/972_2.png) [@vladimir](https://discuss.dgraph.io/u/vladimir)\
**Post date:** [March 4, 2020, 11:11am UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062/7 "2020-03-04T11:11:21Z")

</div>

Hello.  
I can 't export anything at all  
Where is my mistake  
On windows 10  
**dgraph zero**  
**dgraph alpha --lru\_mb 4096**  
**curl [http://localhost:8080/admin/export](http://localhost:8080/admin/export)**

```auto
StatusCode : 200
StatusDescription : OK
Content : Dgraph browser is available for running separately using the dgraph-ratel binary
RawContent : HTTP/1.1 200 OK
                    Content-Length: 80
                    Content-Type: text/plain; charset=utf-8
                    Date: Wed, 04 Mar 2020 11:06:47 GMT

                    Dgraph browser is available for running separately using the dgraph-ratel binary
Forms : {}
Headers : {[Content-Length, 80], [Content-Type, text/plain; charset=utf-8], [Date, Wed, 04 Mar 2020 11:06:47
                    GMT]}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 80

```

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [March 4, 2020, 5:03pm UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062/8 "2020-03-04T17:03:01Z")

</div>

> [@vladimir](#):
>
> Dgraph version : v2.0.0-rc1

Maybe this is the issue. I think in that version this export endpoint was removed (It will be deprecated, but in the future, in the latest version it is back). You need to use the GraphQL Admin endpoint tho.

Use cURL or some GraphQL UI (e.g. _Insomnia REST Client_) and run this mutation.

```auto
mutation {
		export(input: {format: "rdf"}) {
			response {
				code
				message
			}
		}
	}

```

---

<div class="post-metadata">

**Author:** ![vladimir](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/vladimir/32/972_2.png) [@vladimir](https://discuss.dgraph.io/u/vladimir)\
**Post date:** [March 4, 2020, 6:44pm UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062/9 "2020-03-04T18:44:03Z")

</div>

It doesn’t work.  
Maybe I’m doing something wrong

 ![Снимок экрана (18)](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/3/3e5e19d2569f38d908e81a71e35ece306a540fc5.png)

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [March 4, 2020, 6:52pm UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062/10 "2020-03-04T18:52:16Z")

</div>

the endpoint is `:8080/admin`

---

<div class="post-metadata">

**Author:** ![vladimir](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/vladimir/32/972_2.png) [@vladimir](https://discuss.dgraph.io/u/vladimir)\
**Post date:** [March 4, 2020, 7:13pm UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062/11 "2020-03-04T19:13:03Z")

</div>

Ok. How I can fix ErrorUnauthorized

 ![Снимок экрана (20)](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/9/973cae38a21eebd59d5912e10e559149fdf9ccb7.png)

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [March 4, 2020, 7:24pm UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062/12 "2020-03-04T19:24:34Z")

</div>

You have to whitelist your IP or the host IP if you are using a VM.

---

<div class="post-metadata">

**Author:** ![vladimir](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/vladimir/32/972_2.png) [@vladimir](https://discuss.dgraph.io/u/vladimir)\
**Post date:** [March 4, 2020, 7:46pm UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062/13 "2020-03-04T19:46:42Z")

</div>

Ok. I fix it with code:

dgraph alpha --lru\_mb 2048 --whitelist 192.168.0.111

I added some data  
I got the error again

 ![Снимок экрана (21)](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/b/b68d482bf7aa1a5b28821a3e6e6b9efa6111a3a4.png)

How I can fix ‘unable to parse media type’?

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [March 4, 2020, 8:04pm UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062/14 "2020-03-04T20:04:02Z")

</div>

must be something else  
try with curl e.g [dgraph/test-bulk-schema.sh at fa17103ee02397acae317af5bd447d486d4c455d · dgraph-io/dgraph · GitHub](https://github.com/dgraph-io/dgraph/blob/fa17103ee02397acae317af5bd447d486d4c455d/dgraph/cmd/bulk/systest/test-bulk-schema.sh#L118)

---

<div class="post-metadata">

**Author:** ![vladimir](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/vladimir/32/972_2.png) [@vladimir](https://discuss.dgraph.io/u/vladimir)\
**Post date:** [March 4, 2020, 8:13pm UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062/15 "2020-03-04T20:13:19Z")

</div>

I tried this code:

```auto
curl -Ss -H "Content-Type: application/json" http://192.168.0.199:8000/admin -XPO
ST -d '{ "query": "mutation { export(input: {format: \"rdf\"}) { response { code message } }}" }'

```

But again I got an error:  
`Asset not found for path admin`

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [March 4, 2020, 8:47pm UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062/16 "2020-03-04T20:47:37Z")

</div>

> [@vladimir](#):
>
> application/json" [http://192.168.0.199:8000/admin](http://192.168.0.199:8000/admin)

It is 8080 not 8000 (8000 is Ratel’s port)

BTW, read the changelog from [Dgraph v2.0.0-rc1](https://github.com/dgraph-io/dgraph/releases/tag/v2.0.0-rc1).

### Removed

- Remove HTTP admin endpoints. The same functionality is available via GraphQL Admin API. Please see below. ([#4754](https://github.com/dgraph-io/dgraph/pull/4754))

---

<div class="post-metadata">

**Author:** ![vladimir](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/vladimir/32/972_2.png) [@vladimir](https://discuss.dgraph.io/u/vladimir)\
**Post date:** [March 4, 2020, 9:02pm UTC](https://discuss.dgraph.io/t/how-i-can-use-8080-admin-export-with-tls/6062/17 "2020-03-04T21:02:38Z")

</div>

It works for dgraph version : v2.0.0-rc1  
My ip addr is 192.168.0.111  
Target computer ip is 192.168.0.199

```auto
dgraph zero
dgraph alpha --lru_mb 2048 --whitelist localhost,192.168.0.111

```

You can do curl from 192.168.0.111 or localhost ([http://localhost:8080/admin](http://localhost:8080/admin))

curl -Ss -H “Content-Type: application/json” [http://192.168.0.199:8080/admin](http://192.168.0.199:8080/admin) -XPOST -d ‘{ “query”: “mutation { export(input: {format: “rdf”}) { response { code message } }}” }’

It’s response:  
{“data”:{“export”:{“response”:{“code”:“Success”,“message”:“Export completed.”}}}}
