dongwon lee
dongwon lee

Reputation: 79

How to use curl in unity by changing curl to WWWform

I need to authenticate to use a specific map API, which is the authentication method curl.

But I don't know how to use curl by changing it to form.

curl "https://naveropenapi.apigw.ntruss.com/map-static/v2/raster?w=300&h=300&center=127.1054221,37.3591614&level=16" \
-H "X-NCP-APIGW-API-KEY-ID: {client id}" \
-H "X-NCP-APIGW-API-KEY: {client secret}" -v

Please teach me the way.

Upvotes: 1

Views: 1279

Answers (1)

Trevi Awater
Trevi Awater

Reputation: 2407

You need to set the headers for the request. You can do so by using a Dictonary.

Dictionary<string, string> headers = new Dictionary<string, string>();
headers.Add("X-NCP-APIGW-API-KEY-ID", "{client id}");
headers.Add("X-NCP-APIGW-API-KEY", "{client secret}");

WWW www = new WWW("https://naveropenapi.apigw.ntruss.com/map-static/v2/raster?w=300&h=300&center=127.1054221,37.3591614&level=16", null, headers);
yield return www;

Debug.Log(www.text);

Upvotes: 3

Related Questions