Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbeff298

Browse files
authored
Create requests.go
1 parentb01164f commitbeff298

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed

‎example requests/requests.go

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
// GET /17261/full/max/0/default.jpg. Requests an image with id 17261 with full region, max size, no rotation and default quality in jpg format.
2+
3+
package main
4+
5+
import (
6+
"fmt"
7+
"net/http"
8+
"io/ioutil"
9+
)
10+
11+
funcmain() {
12+
13+
url:="https://munch.emuseum.com/apis/iiif/image/v2/17261/full/max/0/default.jpg"
14+
method:="GET"
15+
16+
client:=&http.Client {
17+
}
18+
req,err:=http.NewRequest(method,url,nil)
19+
20+
iferr!=nil {
21+
fmt.Println(err)
22+
}
23+
res,err:=client.Do(req)
24+
deferres.Body.Close()
25+
body,err:=ioutil.ReadAll(res.Body)
26+
27+
fmt.Println(string(body))
28+
}
29+
30+
31+
// GET /17261/90,0,350,220/max/0/default.jpg. Requests a reqion of an image with ID 17261 with max size, no rotation, default quality and jpg format.
32+
33+
package main
34+
35+
import (
36+
"fmt"
37+
"net/http"
38+
"io/ioutil"
39+
)
40+
41+
funcmain() {
42+
43+
url:="https://munch.emuseum.com/apis/iiif/image/v2/17261/90,0,350,220/max/0/default.jpg"
44+
method:="GET"
45+
46+
client:=&http.Client {
47+
}
48+
req,err:=http.NewRequest(method,url,nil)
49+
50+
iferr!=nil {
51+
fmt.Println(err)
52+
}
53+
res,err:=client.Do(req)
54+
deferres.Body.Close()
55+
body,err:=ioutil.ReadAll(res.Body)
56+
57+
fmt.Println(string(body))
58+
}
59+
60+
61+
// GET /17261/90,0,350,220/max/90/default.jpg. Requests a region of an image with ID 17261 with max size, 90° rotation, default quality and jpg format.
62+
63+
package main
64+
65+
import (
66+
"fmt"
67+
"net/http"
68+
"io/ioutil"
69+
)
70+
71+
funcmain() {
72+
73+
url:="https://munch.emuseum.com/apis/iiif/image/v2/17261/90,0,350,220/max/90/default.jpg"
74+
method:="GET"
75+
76+
client:=&http.Client {
77+
}
78+
req,err:=http.NewRequest(method,url,nil)
79+
80+
iferr!=nil {
81+
fmt.Println(err)
82+
}
83+
res,err:=client.Do(req)
84+
deferres.Body.Close()
85+
body,err:=ioutil.ReadAll(res.Body)
86+
87+
fmt.Println(string(body))
88+
}
89+
90+
91+
// GET /17261/info.json. Requests image information.
92+
93+
package main
94+
95+
import (
96+
"fmt"
97+
"net/http"
98+
"io/ioutil"
99+
)
100+
101+
funcmain() {
102+
103+
url:="https://munch.emuseum.com/apis/iiif/image/v2/17261/info.json"
104+
method:="GET"
105+
106+
client:=&http.Client {
107+
}
108+
req,err:=http.NewRequest(method,url,nil)
109+
110+
iferr!=nil {
111+
fmt.Println(err)
112+
}
113+
res,err:=client.Do(req)
114+
deferres.Body.Close()
115+
body,err:=ioutil.ReadAll(res.Body)
116+
117+
fmt.Println(string(body))
118+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp