0

Nokia の HERE バッチ ジオコーディング サービスにファイルを投稿するには、この作業用の curl ステートメントがあります...

curl -X POST -H 'Content-Type: multipart/form-data;boundary=----------------------------4ebf00fbcf09' \
     --data-binary @example.txt \
     'http://batch.geocoder.cit.api.here.com/6.2/jobs?action=run&mailto=test@gmail.com&maxresults=1&language=es-ES&header=true&indelim=|&outdelim=|&outcols=displayLatitude,displayLongitude,houseNumber,street,district,city,postalCode,county,state,country,matchLevel,relevance&outputCombined=false&app_code=AJKnXv84fjrb0KIHawS0Tg&app_id=DemoAppId01082013GAL'

私はこれを試しました:

library(RCurl) 
url <- "http://batch.geocoder.cit.api.here.com/6.2/jobs?    action=run&mailto=test@gmail.com&maxresults=1&language=es-ES&header=true&indelim=|&outdelim=|&outcols=displayLatitude,displayLongitude,houseNumber,street,district,city,postalCode,county,state,country,matchLevel,relevance&outputCombined=false&app_code=AJKnXv84fjrb0KIHawS0Tg&app_id=DemoAppId01082013GAL'" 
postForm(url, file=fileUpload(filename="example.txt",
                 contentType="multipart/form-data;boundary=----------------------------4ebf00fbcf09"))

この:

library(httr)
a <- POST(url, body=upload_file("example.txt", type="text/plain"),
          config=c(add_headers("multipart/form-data;boundary=----------------------------4ebf00fbcf09")))
content(a)

このファイルを次のように使用しますexample.txt: https://gist.github.com/corynissen/4f30378f11a5e51ad9ad

Rでこのプロパティを実行する方法はありますか?

4

2 に答える 2

3

私は Nokia の開発者ではありません。これらは実際の API の信用情報ではないと思います。これは、次のことをさらに進めるのに役立ちますhttr

url <- "http://batch.geocoder.cit.api.here.com/6.2/jobs"

a <- POST(url, encode="multipart",                      # this will set the header for you
          body=list(file=upload_file("example.txt")),   # this is how to upload files
          query=list(
            action="run",
            mailto="test@example.com",
            maxresults="1",
            language="es-ES",                           # this will build the query string
            header="true",
            indelim="|",
            outdelim="|",
            outcols="displayLatitude,displayLongitude", # i shortened this for the example
            outputCombined="false",
            app_code="APPCODE",
            app_id="APPID"), 
          verbose())                                    # this lets you verify what's going on

しかし、登録しないと確信が持てません (そして登録する時間もありません)。

于 2014-10-28T15:27:42.050 に答える