파일 업로드
Last updated
Last updated
POST https://api.coolsms.co.kr/storage/v1/files
파일을 업로드합니다.
타입별 제한 사이즈
[KAKAO] : 500KB
[MMS] : 200KB
[DOCUMENT] : 2MB
{
"file": "string",
"name": "string",
"type": "string",
"link": "string"
}
{
"kakao": {
"daou": "string",
"biztalk": "string"
},
"type": "string",
"originalName": "string",
"link": "string",
"fileId": "string",
"name": "string",
"url": "string",
"accountId": "string",
"references": [
"string"
],
"dateCreated": "date",
"dateUpdated": "date"
}
Sample Request
{
"file": "iVBORw0KGgoAAAANSUhEUgAAAyA..."
}
Sample Response
{
"kakao": {
"daou": null,
"biztalk": null
},
"type": "DOCUMENT",
"originalName": "I8xNI.png",
"link": null,
"width": 800,
"height": 500,
"fileSize": 503111,
"fileId": "ST01FP200923043341379MfcAwzt2BHu",
"name": "I8xNI.png",
"url": "https://coolsms-storage-test.s3.ap-northeast-2.amazonaws.com/53901839183913/ST01FP200923043341379MfcAwzt2BHu",
"accountId": "53901839183913",
"references": [],
"dateCreated": "2020-09-23T03:33:41.479Z",
"dateUpdated": "2020-09-23T03:33:41.479Z"
}
Sample Code
var request = require('request');
var options = {
headers: {
Authorization:
'HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4',
'Content-Type': 'application/json'
},
body: {
file: 'iVBORw0KGgoAAAANSUhEUgAAAyA...'
},
method: 'POST',
json: true,
url: 'http://api.coolsms.co.kr/storage/v1/files'
};
request(options, function(error, response, body) {
if (error) throw error;
console.log('result :', body);
});
<?php
$url = "http://api.coolsms.co.kr/storage/v1/files";
$data = '{"file":"iVBORw0KGgoAAAANSUhEUgAAAyA..."}';
$options = array(
'http' => array(
'header' => "Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4\r\n" . "Content-Type: application/json\r\n",
'content' => $data,
'method' => 'POST'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);
import requests
url = "http://api.coolsms.co.kr/storage/v1/files"
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = '{"file":"iVBORw0KGgoAAAANSUhEUgAAAyA..."}'
response = requests.post(url, headers=headers, data=data)
print(response.status_code)
print(response.text)
#!/bin/bash
curl -X POST \
-H 'Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4' \
-H 'Content-Type: application/json' \
-d '{"file":"iVBORw0KGgoAAAANSUhEUgAAAyA..."}' \
http://api.coolsms.co.kr/storage/v1/files
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("http://api.coolsms.co.kr/storage/v1/files")
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = {
"file": "iVBORw0KGgoAAAANSUhEUgAAAyA..."
}
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, headers)
request.body = data.to_json
response = http.request(request)
puts response.code
puts response.body
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
uri := "http://api.coolsms.co.kr/storage/v1/files"
data := strings.NewReader(`{"file":"iVBORw0KGgoAAAANSUhEUgAAAyA..."}`)
req, err := http.NewRequest("POST", uri, data)
if err != nil { panic(err) }
req.Header.Set("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
bytes, _ := ioutil.ReadAll(resp.Body)
str := string(bytes)
fmt.Println(str)
}
package solapi;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Request {
public static void main(String[] args) throws Exception {
String targetUrl = "http://api.coolsms.co.kr/storage/v1/files";
String parameters = "{\"file\":\"iVBORw0KGgoAAAANSUhEUgAAAyA...\"}";
URL url = new URL(targetUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(parameters);
wr.flush();
wr.close();
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String line;
StringBuffer response = new StringBuffer();
while ((line = in.readLine()) != null) {
response.append(line);
}
in.close();
System.out.println("HTTP response code : " + responseCode);
System.out.println("HTTP body : " + response.toString());
}
}
Sample Request
{
"file": "iVBORw0KGgoAAAANSUhEUgAAAyA...",
"name": "smile.png"
}
Sample Response
{
"kakao": {
"daou": null,
"biztalk": null
},
"type": "DOCUMENT",
"originalName": "smile.png",
"link": null,
"width": 800,
"height": 500,
"fileSize": 503111,
"fileId": "ST01FP200923043341529iTxkKMOVoO2",
"name": "Cm40E.png",
"url": "https://coolsms-storage-test.s3.ap-northeast-2.amazonaws.com/53901839183913/ST01FP200923043341529iTxkKMOVoO2",
"accountId": "53901839183913",
"references": [],
"dateCreated": "2020-09-23T03:33:41.620Z",
"dateUpdated": "2020-09-23T03:33:41.620Z"
}
Sample Code
var request = require('request');
var options = {
headers: {
Authorization:
'HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4',
'Content-Type': 'application/json'
},
body: {
file: 'iVBORw0KGgoAAAANSUhEUgAAAyA...',
name: 'smile.png'
},
method: 'POST',
json: true,
url: 'http://api.coolsms.co.kr/storage/v1/files'
};
request(options, function(error, response, body) {
if (error) throw error;
console.log('result :', body);
});
<?php
$url = "http://api.coolsms.co.kr/storage/v1/files";
$data = '{"file":"iVBORw0KGgoAAAANSUhEUgAAAyA...","name":"smile.png"}';
$options = array(
'http' => array(
'header' => "Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4\r\n" . "Content-Type: application/json\r\n",
'content' => $data,
'method' => 'POST'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);
import requests
url = "http://api.coolsms.co.kr/storage/v1/files"
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = '{"file":"iVBORw0KGgoAAAANSUhEUgAAAyA...","name":"smile.png"}'
response = requests.post(url, headers=headers, data=data)
print(response.status_code)
print(response.text)
#!/bin/bash
curl -X POST \
-H 'Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4' \
-H 'Content-Type: application/json' \
-d '{"file":"iVBORw0KGgoAAAANSUhEUgAAAyA...","name":"smile.png"}' \
http://api.coolsms.co.kr/storage/v1/files
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("http://api.coolsms.co.kr/storage/v1/files")
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = {
"file": "iVBORw0KGgoAAAANSUhEUgAAAyA...",
"name": "smile.png"
}
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, headers)
request.body = data.to_json
response = http.request(request)
puts response.code
puts response.body
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
uri := "http://api.coolsms.co.kr/storage/v1/files"
data := strings.NewReader(`{"file":"iVBORw0KGgoAAAANSUhEUgAAAyA...","name":"smile.png"}`)
req, err := http.NewRequest("POST", uri, data)
if err != nil { panic(err) }
req.Header.Set("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
bytes, _ := ioutil.ReadAll(resp.Body)
str := string(bytes)
fmt.Println(str)
}
package solapi;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Request {
public static void main(String[] args) throws Exception {
String targetUrl = "http://api.coolsms.co.kr/storage/v1/files";
String parameters = "{\"file\":\"iVBORw0KGgoAAAANSUhEUgAAAyA...\",\"name\":\"smile.png\"}";
URL url = new URL(targetUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(parameters);
wr.flush();
wr.close();
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String line;
StringBuffer response = new StringBuffer();
while ((line = in.readLine()) != null) {
response.append(line);
}
in.close();
System.out.println("HTTP response code : " + responseCode);
System.out.println("HTTP body : " + response.toString());
}
}
Sample Request
{
"file": "/9j/4AAQSkZJRgABAQAAAQABAAD..."
}
Sample Response
{
"kakao": {
"daou": null,
"biztalk": null
},
"type": "DOCUMENT",
"originalName": "hDpGY.jpg",
"link": null,
"width": 1020,
"height": 510,
"fileSize": 124814,
"fileId": "ST01FJ200923043341643gYUXqmL5NyV",
"name": "hDpGY.jpg",
"url": "https://coolsms-storage-test.s3.ap-northeast-2.amazonaws.com/53901839183913/ST01FJ200923043341643gYUXqmL5NyV",
"accountId": "53901839183913",
"references": [],
"dateCreated": "2020-09-23T03:33:41.706Z",
"dateUpdated": "2020-09-23T03:33:41.706Z"
}
Sample Code
var request = require('request');
var options = {
headers: {
Authorization:
'HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4',
'Content-Type': 'application/json'
},
body: {
file: '/9j/4AAQSkZJRgABAQAAAQABAAD...'
},
method: 'POST',
json: true,
url: 'http://api.coolsms.co.kr/storage/v1/files'
};
request(options, function(error, response, body) {
if (error) throw error;
console.log('result :', body);
});
<?php
$url = "http://api.coolsms.co.kr/storage/v1/files";
$data = '{"file":"/9j/4AAQSkZJRgABAQAAAQABAAD..."}';
$options = array(
'http' => array(
'header' => "Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4\r\n" . "Content-Type: application/json\r\n",
'content' => $data,
'method' => 'POST'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);
import requests
url = "http://api.coolsms.co.kr/storage/v1/files"
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = '{"file":"/9j/4AAQSkZJRgABAQAAAQABAAD..."}'
response = requests.post(url, headers=headers, data=data)
print(response.status_code)
print(response.text)
#!/bin/bash
curl -X POST \
-H 'Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4' \
-H 'Content-Type: application/json' \
-d '{"file":"/9j/4AAQSkZJRgABAQAAAQABAAD..."}' \
http://api.coolsms.co.kr/storage/v1/files
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("http://api.coolsms.co.kr/storage/v1/files")
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = {
"file": "/9j/4AAQSkZJRgABAQAAAQABAAD..."
}
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, headers)
request.body = data.to_json
response = http.request(request)
puts response.code
puts response.body
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
uri := "http://api.coolsms.co.kr/storage/v1/files"
data := strings.NewReader(`{"file":"/9j/4AAQSkZJRgABAQAAAQABAAD..."}`)
req, err := http.NewRequest("POST", uri, data)
if err != nil { panic(err) }
req.Header.Set("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
bytes, _ := ioutil.ReadAll(resp.Body)
str := string(bytes)
fmt.Println(str)
}
package solapi;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Request {
public static void main(String[] args) throws Exception {
String targetUrl = "http://api.coolsms.co.kr/storage/v1/files";
String parameters = "{\"file\":\"/9j/4AAQSkZJRgABAQAAAQABAAD...\"}";
URL url = new URL(targetUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(parameters);
wr.flush();
wr.close();
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String line;
StringBuffer response = new StringBuffer();
while ((line = in.readLine()) != null) {
response.append(line);
}
in.close();
System.out.println("HTTP response code : " + responseCode);
System.out.println("HTTP body : " + response.toString());
}
}
Sample Request
{
"file": "/9j/4AAQSkZJRgABAQAAAQABAAD..."
}
Sample Response
{
"kakao": {
"daou": null,
"biztalk": null
},
"type": "DOCUMENT",
"originalName": "MmNcF.jpg",
"link": null,
"width": 629,
"height": 436,
"fileSize": 127596,
"fileId": "ST01FJ200923043341723qlGm1hg3YcS",
"name": "MmNcF.jpg",
"url": "https://coolsms-storage-test.s3.ap-northeast-2.amazonaws.com/53901839183913/ST01FJ200923043341723qlGm1hg3YcS",
"accountId": "53901839183913",
"references": [],
"dateCreated": "2020-09-23T03:33:41.814Z",
"dateUpdated": "2020-09-23T03:33:41.814Z"
}
Sample Code
var request = require('request');
var options = {
headers: {
Authorization:
'HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4',
'Content-Type': 'application/json'
},
body: {
file: '/9j/4AAQSkZJRgABAQAAAQABAAD...'
},
method: 'POST',
json: true,
url: 'http://api.coolsms.co.kr/storage/v1/files'
};
request(options, function(error, response, body) {
if (error) throw error;
console.log('result :', body);
});
<?php
$url = "http://api.coolsms.co.kr/storage/v1/files";
$data = '{"file":"/9j/4AAQSkZJRgABAQAAAQABAAD..."}';
$options = array(
'http' => array(
'header' => "Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4\r\n" . "Content-Type: application/json\r\n",
'content' => $data,
'method' => 'POST'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);
import requests
url = "http://api.coolsms.co.kr/storage/v1/files"
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = '{"file":"/9j/4AAQSkZJRgABAQAAAQABAAD..."}'
response = requests.post(url, headers=headers, data=data)
print(response.status_code)
print(response.text)
#!/bin/bash
curl -X POST \
-H 'Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4' \
-H 'Content-Type: application/json' \
-d '{"file":"/9j/4AAQSkZJRgABAQAAAQABAAD..."}' \
http://api.coolsms.co.kr/storage/v1/files
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("http://api.coolsms.co.kr/storage/v1/files")
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = {
"file": "/9j/4AAQSkZJRgABAQAAAQABAAD..."
}
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, headers)
request.body = data.to_json
response = http.request(request)
puts response.code
puts response.body
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
uri := "http://api.coolsms.co.kr/storage/v1/files"
data := strings.NewReader(`{"file":"/9j/4AAQSkZJRgABAQAAAQABAAD..."}`)
req, err := http.NewRequest("POST", uri, data)
if err != nil { panic(err) }
req.Header.Set("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
bytes, _ := ioutil.ReadAll(resp.Body)
str := string(bytes)
fmt.Println(str)
}
package solapi;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Request {
public static void main(String[] args) throws Exception {
String targetUrl = "http://api.coolsms.co.kr/storage/v1/files";
String parameters = "{\"file\":\"/9j/4AAQSkZJRgABAQAAAQABAAD...\"}";
URL url = new URL(targetUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(parameters);
wr.flush();
wr.close();
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String line;
StringBuffer response = new StringBuffer();
while ((line = in.readLine()) != null) {
response.append(line);
}
in.close();
System.out.println("HTTP response code : " + responseCode);
System.out.println("HTTP body : " + response.toString());
}
}
Sample Request
{
"file": "SUkqAL42BADHwpjCvZPHwpjMx53..."
}
Sample Response
{
"kakao": {
"daou": null,
"biztalk": null
},
"type": "DOCUMENT",
"originalName": "Suebb.tif",
"link": null,
"width": null,
"height": null,
"fileSize": 276466,
"fileId": "ST01FT2009230433418362U1Ky0iPLFa",
"name": "Suebb.tif",
"url": "https://coolsms-storage-test.s3.ap-northeast-2.amazonaws.com/53901839183913/ST01FT2009230433418362U1Ky0iPLFa",
"accountId": "53901839183913",
"references": [],
"dateCreated": "2020-09-23T03:33:41.944Z",
"dateUpdated": "2020-09-23T03:33:41.944Z"
}
Sample Code
var request = require('request');
var options = {
headers: {
Authorization:
'HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4',
'Content-Type': 'application/json'
},
body: {
file: 'SUkqAL42BADHwpjCvZPHwpjMx53...'
},
method: 'POST',
json: true,
url: 'http://api.coolsms.co.kr/storage/v1/files'
};
request(options, function(error, response, body) {
if (error) throw error;
console.log('result :', body);
});
<?php
$url = "http://api.coolsms.co.kr/storage/v1/files";
$data = '{"file":"SUkqAL42BADHwpjCvZPHwpjMx53..."}';
$options = array(
'http' => array(
'header' => "Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4\r\n" . "Content-Type: application/json\r\n",
'content' => $data,
'method' => 'POST'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);
import requests
url = "http://api.coolsms.co.kr/storage/v1/files"
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = '{"file":"SUkqAL42BADHwpjCvZPHwpjMx53..."}'
response = requests.post(url, headers=headers, data=data)
print(response.status_code)
print(response.text)
#!/bin/bash
curl -X POST \
-H 'Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4' \
-H 'Content-Type: application/json' \
-d '{"file":"SUkqAL42BADHwpjCvZPHwpjMx53..."}' \
http://api.coolsms.co.kr/storage/v1/files
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("http://api.coolsms.co.kr/storage/v1/files")
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = {
"file": "SUkqAL42BADHwpjCvZPHwpjMx53..."
}
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, headers)
request.body = data.to_json
response = http.request(request)
puts response.code
puts response.body
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
uri := "http://api.coolsms.co.kr/storage/v1/files"
data := strings.NewReader(`{"file":"SUkqAL42BADHwpjCvZPHwpjMx53..."}`)
req, err := http.NewRequest("POST", uri, data)
if err != nil { panic(err) }
req.Header.Set("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
bytes, _ := ioutil.ReadAll(resp.Body)
str := string(bytes)
fmt.Println(str)
}
package solapi;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Request {
public static void main(String[] args) throws Exception {
String targetUrl = "http://api.coolsms.co.kr/storage/v1/files";
String parameters = "{\"file\":\"SUkqAL42BADHwpjCvZPHwpjMx53...\"}";
URL url = new URL(targetUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(parameters);
wr.flush();
wr.close();
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String line;
StringBuffer response = new StringBuffer();
while ((line = in.readLine()) != null) {
response.append(line);
}
in.close();
System.out.println("HTTP response code : " + responseCode);
System.out.println("HTTP body : " + response.toString());
}
}
Sample Request
{
"file": "SUkqAOT2DgDW397a4+Le5+bd5uX..."
}
Sample Response
{
"kakao": {
"daou": null,
"biztalk": null
},
"type": "DOCUMENT",
"originalName": "MgKEx.tif",
"link": null,
"width": null,
"height": null,
"fileSize": 980964,
"fileId": "ST01FT200923043342035QNT7P33ab3d",
"name": "MgKEx.tif",
"url": "https://coolsms-storage-test.s3.ap-northeast-2.amazonaws.com/53901839183913/ST01FT200923043342035QNT7P33ab3d",
"accountId": "53901839183913",
"references": [],
"dateCreated": "2020-09-23T03:33:42.119Z",
"dateUpdated": "2020-09-23T03:33:42.119Z"
}
Sample Code
var request = require('request');
var options = {
headers: {
Authorization:
'HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4',
'Content-Type': 'application/json'
},
body: {
file: 'SUkqAOT2DgDW397a4+Le5+bd5uX...'
},
method: 'POST',
json: true,
url: 'http://api.coolsms.co.kr/storage/v1/files'
};
request(options, function(error, response, body) {
if (error) throw error;
console.log('result :', body);
});
<?php
$url = "http://api.coolsms.co.kr/storage/v1/files";
$data = '{"file":"SUkqAOT2DgDW397a4+Le5+bd5uX..."}';
$options = array(
'http' => array(
'header' => "Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4\r\n" . "Content-Type: application/json\r\n",
'content' => $data,
'method' => 'POST'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);
import requests
url = "http://api.coolsms.co.kr/storage/v1/files"
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = '{"file":"SUkqAOT2DgDW397a4+Le5+bd5uX..."}'
response = requests.post(url, headers=headers, data=data)
print(response.status_code)
print(response.text)
#!/bin/bash
curl -X POST \
-H 'Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4' \
-H 'Content-Type: application/json' \
-d '{"file":"SUkqAOT2DgDW397a4+Le5+bd5uX..."}' \
http://api.coolsms.co.kr/storage/v1/files
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("http://api.coolsms.co.kr/storage/v1/files")
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = {
"file": "SUkqAOT2DgDW397a4+Le5+bd5uX..."
}
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, headers)
request.body = data.to_json
response = http.request(request)
puts response.code
puts response.body
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
uri := "http://api.coolsms.co.kr/storage/v1/files"
data := strings.NewReader(`{"file":"SUkqAOT2DgDW397a4+Le5+bd5uX..."}`)
req, err := http.NewRequest("POST", uri, data)
if err != nil { panic(err) }
req.Header.Set("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
bytes, _ := ioutil.ReadAll(resp.Body)
str := string(bytes)
fmt.Println(str)
}
package solapi;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Request {
public static void main(String[] args) throws Exception {
String targetUrl = "http://api.coolsms.co.kr/storage/v1/files";
String parameters = "{\"file\":\"SUkqAOT2DgDW397a4+Le5+bd5uX...\"}";
URL url = new URL(targetUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(parameters);
wr.flush();
wr.close();
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String line;
StringBuffer response = new StringBuffer();
while ((line = in.readLine()) != null) {
response.append(line);
}
in.close();
System.out.println("HTTP response code : " + responseCode);
System.out.println("HTTP body : " + response.toString());
}
}
Sample Request
{
"file": "R0lGODlh6gEGAuZzAAAAAAAACAA..."
}
Sample Response
{
"kakao": {
"daou": null,
"biztalk": null
},
"type": "DOCUMENT",
"originalName": "Duuvm.gif",
"link": null,
"width": 490,
"height": 518,
"fileSize": 62704,
"fileId": "ST01FG200923043342141EtNlHkwkujL",
"name": "Duuvm.gif",
"url": "https://coolsms-storage-test.s3.ap-northeast-2.amazonaws.com/53901839183913/ST01FG200923043342141EtNlHkwkujL",
"accountId": "53901839183913",
"references": [],
"dateCreated": "2020-09-23T03:33:42.221Z",
"dateUpdated": "2020-09-23T03:33:42.221Z"
}
Sample Code
var request = require('request');
var options = {
headers: {
Authorization:
'HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4',
'Content-Type': 'application/json'
},
body: {
file: 'R0lGODlh6gEGAuZzAAAAAAAACAA...'
},
method: 'POST',
json: true,
url: 'http://api.coolsms.co.kr/storage/v1/files'
};
request(options, function(error, response, body) {
if (error) throw error;
console.log('result :', body);
});
<?php
$url = "http://api.coolsms.co.kr/storage/v1/files";
$data = '{"file":"R0lGODlh6gEGAuZzAAAAAAAACAA..."}';
$options = array(
'http' => array(
'header' => "Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4\r\n" . "Content-Type: application/json\r\n",
'content' => $data,
'method' => 'POST'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);
import requests
url = "http://api.coolsms.co.kr/storage/v1/files"
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = '{"file":"R0lGODlh6gEGAuZzAAAAAAAACAA..."}'
response = requests.post(url, headers=headers, data=data)
print(response.status_code)
print(response.text)
#!/bin/bash
curl -X POST \
-H 'Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4' \
-H 'Content-Type: application/json' \
-d '{"file":"R0lGODlh6gEGAuZzAAAAAAAACAA..."}' \
http://api.coolsms.co.kr/storage/v1/files
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("http://api.coolsms.co.kr/storage/v1/files")
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = {
"file": "R0lGODlh6gEGAuZzAAAAAAAACAA..."
}
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, headers)
request.body = data.to_json
response = http.request(request)
puts response.code
puts response.body
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
uri := "http://api.coolsms.co.kr/storage/v1/files"
data := strings.NewReader(`{"file":"R0lGODlh6gEGAuZzAAAAAAAACAA..."}`)
req, err := http.NewRequest("POST", uri, data)
if err != nil { panic(err) }
req.Header.Set("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
bytes, _ := ioutil.ReadAll(resp.Body)
str := string(bytes)
fmt.Println(str)
}
package solapi;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Request {
public static void main(String[] args) throws Exception {
String targetUrl = "http://api.coolsms.co.kr/storage/v1/files";
String parameters = "{\"file\":\"R0lGODlh6gEGAuZzAAAAAAAACAA...\"}";
URL url = new URL(targetUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(parameters);
wr.flush();
wr.close();
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String line;
StringBuffer response = new StringBuffer();
while ((line = in.readLine()) != null) {
response.append(line);
}
in.close();
System.out.println("HTTP response code : " + responseCode);
System.out.println("HTTP body : " + response.toString());
}
}
Sample Request
{
"file": "JVBERi0xLjMNCiXi48/TDQoNCjE..."
}
Sample Response
{
"kakao": {
"daou": null,
"biztalk": null
},
"type": "DOCUMENT",
"originalName": "IeEhg.pdf",
"link": null,
"width": null,
"height": null,
"fileSize": 3028,
"fileId": "ST01FF200923043342235TM6tU6pjymh",
"name": "IeEhg.pdf",
"url": "https://coolsms-storage-test.s3.ap-northeast-2.amazonaws.com/53901839183913/ST01FF200923043342235TM6tU6pjymh",
"accountId": "53901839183913",
"references": [],
"dateCreated": "2020-09-23T03:33:42.273Z",
"dateUpdated": "2020-09-23T03:33:42.273Z"
}
Sample Code
var request = require('request');
var options = {
headers: {
Authorization:
'HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4',
'Content-Type': 'application/json'
},
body: {
file: 'JVBERi0xLjMNCiXi48/TDQoNCjE...'
},
method: 'POST',
json: true,
url: 'http://api.coolsms.co.kr/storage/v1/files'
};
request(options, function(error, response, body) {
if (error) throw error;
console.log('result :', body);
});
<?php
$url = "http://api.coolsms.co.kr/storage/v1/files";
$data = '{"file":"JVBERi0xLjMNCiXi48/TDQoNCjE..."}';
$options = array(
'http' => array(
'header' => "Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4\r\n" . "Content-Type: application/json\r\n",
'content' => $data,
'method' => 'POST'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);
import requests
url = "http://api.coolsms.co.kr/storage/v1/files"
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = '{"file":"JVBERi0xLjMNCiXi48/TDQoNCjE..."}'
response = requests.post(url, headers=headers, data=data)
print(response.status_code)
print(response.text)
#!/bin/bash
curl -X POST \
-H 'Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4' \
-H 'Content-Type: application/json' \
-d '{"file":"JVBERi0xLjMNCiXi48/TDQoNCjE..."}' \
http://api.coolsms.co.kr/storage/v1/files
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("http://api.coolsms.co.kr/storage/v1/files")
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = {
"file": "JVBERi0xLjMNCiXi48/TDQoNCjE..."
}
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, headers)
request.body = data.to_json
response = http.request(request)
puts response.code
puts response.body
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
uri := "http://api.coolsms.co.kr/storage/v1/files"
data := strings.NewReader(`{"file":"JVBERi0xLjMNCiXi48/TDQoNCjE..."}`)
req, err := http.NewRequest("POST", uri, data)
if err != nil { panic(err) }
req.Header.Set("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
bytes, _ := ioutil.ReadAll(resp.Body)
str := string(bytes)
fmt.Println(str)
}
package solapi;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Request {
public static void main(String[] args) throws Exception {
String targetUrl = "http://api.coolsms.co.kr/storage/v1/files";
String parameters = "{\"file\":\"JVBERi0xLjMNCiXi48/TDQoNCjE...\"}";
URL url = new URL(targetUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(parameters);
wr.flush();
wr.close();
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String line;
StringBuffer response = new StringBuffer();
while ((line = in.readLine()) != null) {
response.append(line);
}
in.close();
System.out.println("HTTP response code : " + responseCode);
System.out.println("HTTP body : " + response.toString());
}
}
Sample Request
{
"file": "/9j/4REPRXhpZgAATU0AKgAAAAg..."
}
Sample Response
{
"kakao": {
"daou": null,
"biztalk": null
},
"type": "DOCUMENT",
"originalName": "h_MuT.jpg",
"link": null,
"width": 3506,
"height": 2329,
"fileSize": 1420596,
"fileId": "ST01FJ200923043342353ru5w4jWX46D",
"name": "h_MuT.jpg",
"url": "https://coolsms-storage-test.s3.ap-northeast-2.amazonaws.com/53901839183913/ST01FJ200923043342353ru5w4jWX46D",
"accountId": "53901839183913",
"references": [],
"dateCreated": "2020-09-23T03:33:42.473Z",
"dateUpdated": "2020-09-23T03:33:42.473Z"
}
Sample Code
var request = require('request');
var options = {
headers: {
Authorization:
'HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4',
'Content-Type': 'application/json'
},
body: {
file: '/9j/4REPRXhpZgAATU0AKgAAAAg...'
},
method: 'POST',
json: true,
url: 'http://api.coolsms.co.kr/storage/v1/files'
};
request(options, function(error, response, body) {
if (error) throw error;
console.log('result :', body);
});
<?php
$url = "http://api.coolsms.co.kr/storage/v1/files";
$data = '{"file":"/9j/4REPRXhpZgAATU0AKgAAAAg..."}';
$options = array(
'http' => array(
'header' => "Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4\r\n" . "Content-Type: application/json\r\n",
'content' => $data,
'method' => 'POST'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);
import requests
url = "http://api.coolsms.co.kr/storage/v1/files"
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = '{"file":"/9j/4REPRXhpZgAATU0AKgAAAAg..."}'
response = requests.post(url, headers=headers, data=data)
print(response.status_code)
print(response.text)
#!/bin/bash
curl -X POST \
-H 'Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4' \
-H 'Content-Type: application/json' \
-d '{"file":"/9j/4REPRXhpZgAATU0AKgAAAAg..."}' \
http://api.coolsms.co.kr/storage/v1/files
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("http://api.coolsms.co.kr/storage/v1/files")
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = {
"file": "/9j/4REPRXhpZgAATU0AKgAAAAg..."
}
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, headers)
request.body = data.to_json
response = http.request(request)
puts response.code
puts response.body
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
uri := "http://api.coolsms.co.kr/storage/v1/files"
data := strings.NewReader(`{"file":"/9j/4REPRXhpZgAATU0AKgAAAAg..."}`)
req, err := http.NewRequest("POST", uri, data)
if err != nil { panic(err) }
req.Header.Set("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
bytes, _ := ioutil.ReadAll(resp.Body)
str := string(bytes)
fmt.Println(str)
}
package solapi;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Request {
public static void main(String[] args) throws Exception {
String targetUrl = "http://api.coolsms.co.kr/storage/v1/files";
String parameters = "{\"file\":\"/9j/4REPRXhpZgAATU0AKgAAAAg...\"}";
URL url = new URL(targetUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(parameters);
wr.flush();
wr.close();
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String line;
StringBuffer response = new StringBuffer();
while ((line = in.readLine()) != null) {
response.append(line);
}
in.close();
System.out.println("HTTP response code : " + responseCode);
System.out.println("HTTP body : " + response.toString());
}
}
Sample Request
{
"file": "/9j/4AAQSkZJRgABAQEBLAEsAAD...",
"name": "Kakao1",
"type": "MMS"
}
Sample Response
{
"kakao": {
"daou": null,
"biztalk": null
},
"type": "MMS",
"originalName": "Kakao1",
"link": null,
"width": 689,
"height": 689,
"fileSize": 102796,
"fileId": "ST01FJ200923043342503ZWsXdXEir4B",
"name": "aRpmd.jpg",
"url": "https://coolsms-storage-test.s3.ap-northeast-2.amazonaws.com/53901839183913/ST01FJ200923043342503ZWsXdXEir4B",
"accountId": "53901839183913",
"references": [],
"dateCreated": "2020-09-23T03:33:42.633Z",
"dateUpdated": "2020-09-23T03:33:42.633Z"
}
Sample Code
var request = require('request');
var options = {
headers: {
Authorization:
'HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4',
'Content-Type': 'application/json'
},
body: {
file: '/9j/4AAQSkZJRgABAQEBLAEsAAD...',
name: 'Kakao1',
type: 'MMS'
},
method: 'POST',
json: true,
url: 'http://api.coolsms.co.kr/storage/v1/files'
};
request(options, function(error, response, body) {
if (error) throw error;
console.log('result :', body);
});
<?php
$url = "http://api.coolsms.co.kr/storage/v1/files";
$data = '{"file":"/9j/4AAQSkZJRgABAQEBLAEsAAD...","name":"Kakao1","type":"MMS"}';
$options = array(
'http' => array(
'header' => "Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4\r\n" . "Content-Type: application/json\r\n",
'content' => $data,
'method' => 'POST'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);
import requests
url = "http://api.coolsms.co.kr/storage/v1/files"
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = '{"file":"/9j/4AAQSkZJRgABAQEBLAEsAAD...","name":"Kakao1","type":"MMS"}'
response = requests.post(url, headers=headers, data=data)
print(response.status_code)
print(response.text)
#!/bin/bash
curl -X POST \
-H 'Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4' \
-H 'Content-Type: application/json' \
-d '{"file":"/9j/4AAQSkZJRgABAQEBLAEsAAD...","name":"Kakao1","type":"MMS"}' \
http://api.coolsms.co.kr/storage/v1/files
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("http://api.coolsms.co.kr/storage/v1/files")
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = {
"file": "/9j/4AAQSkZJRgABAQEBLAEsAAD...",
"name": "Kakao1",
"type": "MMS"
}
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, headers)
request.body = data.to_json
response = http.request(request)
puts response.code
puts response.body
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
uri := "http://api.coolsms.co.kr/storage/v1/files"
data := strings.NewReader(`{"file":"/9j/4AAQSkZJRgABAQEBLAEsAAD...","name":"Kakao1","type":"MMS"}`)
req, err := http.NewRequest("POST", uri, data)
if err != nil { panic(err) }
req.Header.Set("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
bytes, _ := ioutil.ReadAll(resp.Body)
str := string(bytes)
fmt.Println(str)
}
package solapi;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Request {
public static void main(String[] args) throws Exception {
String targetUrl = "http://api.coolsms.co.kr/storage/v1/files";
String parameters = "{\"file\":\"/9j/4AAQSkZJRgABAQEBLAEsAAD...\",\"name\":\"Kakao1\",\"type\":\"MMS\"}";
URL url = new URL(targetUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(parameters);
wr.flush();
wr.close();
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String line;
StringBuffer response = new StringBuffer();
while ((line = in.readLine()) != null) {
response.append(line);
}
in.close();
System.out.println("HTTP response code : " + responseCode);
System.out.println("HTTP body : " + response.toString());
}
}
Sample Request
{
"file": "iVBORw0KGgoAAAANSUhEUgAAAyA...",
"name": "Kakao1",
"link": "https://solapi.com",
"type": "KAKAO"
}
Sample Response
{
"kakao": {
"daou": "http://mud-kage.kakao.com/dn/FQKZu/btqytT1XOEk/0f5vpzODWOuTvO8iW4wfwk/testImage.png",
"biztalk": "http://mud-kage.kakao.com/dn/FQKZu/btqytT1XOEk/0f5vpzODWOuTvO8iW4wfwk/testImage.png"
},
"type": "KAKAO",
"originalName": "Kakao1",
"link": "https://solapi.com",
"width": 800,
"height": 500,
"fileSize": 503111,
"fileId": "ST01FP200923043342700YH3XUalTwND",
"name": "VVOjD.png",
"url": "https://coolsms-storage-test.s3.ap-northeast-2.amazonaws.com/53901839183913/ST01FP200923043342700YH3XUalTwND",
"accountId": "53901839183913",
"references": [],
"dateCreated": "2020-09-23T03:33:42.876Z",
"dateUpdated": "2020-09-23T03:33:42.876Z"
}
Sample Code
var request = require('request');
var options = {
headers: {
Authorization:
'HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4',
'Content-Type': 'application/json'
},
body: {
file: 'iVBORw0KGgoAAAANSUhEUgAAAyA...',
name: 'Kakao1',
link: 'https://solapi.com',
type: 'KAKAO'
},
method: 'POST',
json: true,
url: 'http://api.coolsms.co.kr/storage/v1/files'
};
request(options, function(error, response, body) {
if (error) throw error;
console.log('result :', body);
});
<?php
$url = "http://api.coolsms.co.kr/storage/v1/files";
$data = '{"file":"iVBORw0KGgoAAAANSUhEUgAAAyA...","name":"Kakao1","link":"https://solapi.com","type":"KAKAO"}';
$options = array(
'http' => array(
'header' => "Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4\r\n" . "Content-Type: application/json\r\n",
'content' => $data,
'method' => 'POST'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);
import requests
url = "http://api.coolsms.co.kr/storage/v1/files"
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = '{"file":"iVBORw0KGgoAAAANSUhEUgAAAyA...","name":"Kakao1","link":"https://solapi.com","type":"KAKAO"}'
response = requests.post(url, headers=headers, data=data)
print(response.status_code)
print(response.text)
#!/bin/bash
curl -X POST \
-H 'Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4' \
-H 'Content-Type: application/json' \
-d '{"file":"iVBORw0KGgoAAAANSUhEUgAAAyA...","name":"Kakao1","link":"https://solapi.com","type":"KAKAO"}' \
http://api.coolsms.co.kr/storage/v1/files
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("http://api.coolsms.co.kr/storage/v1/files")
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = {
"file": "iVBORw0KGgoAAAANSUhEUgAAAyA...",
"name": "Kakao1",
"link": "https://solapi.com",
"type": "KAKAO"
}
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, headers)
request.body = data.to_json
response = http.request(request)
puts response.code
puts response.body
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
uri := "http://api.coolsms.co.kr/storage/v1/files"
data := strings.NewReader(`{"file":"iVBORw0KGgoAAAANSUhEUgAAAyA...","name":"Kakao1","link":"https://solapi.com","type":"KAKAO"}`)
req, err := http.NewRequest("POST", uri, data)
if err != nil { panic(err) }
req.Header.Set("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
bytes, _ := ioutil.ReadAll(resp.Body)
str := string(bytes)
fmt.Println(str)
}
package solapi;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Request {
public static void main(String[] args) throws Exception {
String targetUrl = "http://api.coolsms.co.kr/storage/v1/files";
String parameters = "{\"file\":\"iVBORw0KGgoAAAANSUhEUgAAAyA...\",\"name\":\"Kakao1\",\"link\":\"https://solapi.com\",\"type\":\"KAKAO\"}";
URL url = new URL(targetUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(parameters);
wr.flush();
wr.close();
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String line;
StringBuffer response = new StringBuffer();
while ((line = in.readLine()) != null) {
response.append(line);
}
in.close();
System.out.println("HTTP response code : " + responseCode);
System.out.println("HTTP body : " + response.toString());
}
}
Sample Request
{
"file": "/9j/4AAQSkZJRgABAQAAAQABAAD...",
"name": "Kakao1",
"link": "https://solapi.com",
"type": "KAKAO"
}
Sample Response
{
"kakao": {
"daou": "http://mud-kage.kakao.com/dn/FQKZu/btqytT1XOEk/0f5vpzODWOuTvO8iW4wfwk/testImage.png",
"biztalk": null
},
"type": "KAKAO",
"originalName": "Kakao1",
"link": "https://solapi.com",
"width": 629,
"height": 436,
"fileSize": 127596,
"fileId": "ST01FJ200923043342894azJQa5ZbZgz",
"name": "ILKaq.jpg",
"url": "https://coolsms-storage-test.s3.ap-northeast-2.amazonaws.com/53901839183913/ST01FJ200923043342894azJQa5ZbZgz",
"accountId": "53901839183913",
"references": [],
"dateCreated": "2020-09-23T03:33:42.961Z",
"dateUpdated": "2020-09-23T03:33:42.961Z"
}
Sample Code
var request = require('request');
var options = {
headers: {
Authorization:
'HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4',
'Content-Type': 'application/json'
},
body: {
file: '/9j/4AAQSkZJRgABAQAAAQABAAD...',
name: 'Kakao1',
link: 'https://solapi.com',
type: 'KAKAO'
},
method: 'POST',
json: true,
url: 'http://api.coolsms.co.kr/storage/v1/files'
};
request(options, function(error, response, body) {
if (error) throw error;
console.log('result :', body);
});
<?php
$url = "http://api.coolsms.co.kr/storage/v1/files";
$data = '{"file":"/9j/4AAQSkZJRgABAQAAAQABAAD...","name":"Kakao1","link":"https://solapi.com","type":"KAKAO"}';
$options = array(
'http' => array(
'header' => "Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4\r\n" . "Content-Type: application/json\r\n",
'content' => $data,
'method' => 'POST'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);
import requests
url = "http://api.coolsms.co.kr/storage/v1/files"
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = '{"file":"/9j/4AAQSkZJRgABAQAAAQABAAD...","name":"Kakao1","link":"https://solapi.com","type":"KAKAO"}'
response = requests.post(url, headers=headers, data=data)
print(response.status_code)
print(response.text)
#!/bin/bash
curl -X POST \
-H 'Authorization: HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4' \
-H 'Content-Type: application/json' \
-d '{"file":"/9j/4AAQSkZJRgABAQAAAQABAAD...","name":"Kakao1","link":"https://solapi.com","type":"KAKAO"}' \
http://api.coolsms.co.kr/storage/v1/files
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("http://api.coolsms.co.kr/storage/v1/files")
headers = {
"Authorization": "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4",
"Content-Type": "application/json"
}
data = {
"file": "/9j/4AAQSkZJRgABAQAAAQABAAD...",
"name": "Kakao1",
"link": "https://solapi.com",
"type": "KAKAO"
}
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, headers)
request.body = data.to_json
response = http.request(request)
puts response.code
puts response.body
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
uri := "http://api.coolsms.co.kr/storage/v1/files"
data := strings.NewReader(`{"file":"/9j/4AAQSkZJRgABAQAAAQABAAD...","name":"Kakao1","link":"https://solapi.com","type":"KAKAO"}`)
req, err := http.NewRequest("POST", uri, data)
if err != nil { panic(err) }
req.Header.Set("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
bytes, _ := ioutil.ReadAll(resp.Body)
str := string(bytes)
fmt.Println(str)
}
package solapi;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Request {
public static void main(String[] args) throws Exception {
String targetUrl = "http://api.coolsms.co.kr/storage/v1/files";
String parameters = "{\"file\":\"/9j/4AAQSkZJRgABAQAAAQABAAD...\",\"name\":\"Kakao1\",\"link\":\"https://solapi.com\",\"type\":\"KAKAO\"}";
URL url = new URL(targetUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "HMAC-SHA256 apiKey=NCSAYU7YDBXYORXC, date=2019-07-01T00:41:48Z, salt=jqsba2jxjnrjor, signature=1779eac71a24cbeeadfa7263cb84b7ea0af1714f5c0270aa30ffd34600e363b4");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(parameters);
wr.flush();
wr.close();
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String line;
StringBuffer response = new StringBuffer();
while ((line = in.readLine()) != null) {
response.append(line);
}
in.close();
System.out.println("HTTP response code : " + responseCode);
System.out.println("HTTP body : " + response.toString());
}
}
문서 생성일 : 2020-09-23
계정 권한
회원 권한
계정 상태
회원 상태
계정 인증
storage:write
ACTIVE
ACTIVE
Name
Type
Required
Description
file
string
O
파일 (base64 encoded)
name
string
파일 이름
type
string
문서 타입(DOCUMENT, KAKAO, MMS)
link
string
이미지를 눌렀을 때 이동할 링크
Name
Type
Should Return
Description
object
카카오 채널 발송(알림톡, 친구톡)에 사용되는 정보
type
string
O
문서 타입(DOCUMENT, KAKAO, MMS)
originalName
string
O
원본 파일 이름
link
string
이미지를 눌렀을 때 이동할 링크
fileId
string
O
파일 고유 아이디
name
string
O
파일 이름
url
string
O
파일 주소
accountId
string
O
계정 고유 아이디
references
array
해당 파일 사용처 목록
dateCreated
date
O
최초 생성 날짜
dateUpdated
date
O
최근 수정 날짜
Name
Type
Should Return
Description
daou
string
다우기술에 등록되어있는지 여부
biztalk
string
비즈톡에 등록되어있는지 여부