apipostmangarmin

How to turn a ping request on postman using curl


Using Garmin APi, I am trying to use their Ping Service, in the doc they give us an exemple of the request we should do :

curl -v -X POST -H “Content-Type: application/json;charset=utf-8” -d ‘{“epochs”:[{“userAccessToken”:”8f57a6f1-26ba-4b05-a7cd- c6b525a4c7a2”,”uploadStartTimeInSeconds”:1444937651,”uploadEndTimeInSeconds”:1444 937902,”callbackURL”:”https://healthapi.garmin.com/wellness- api/rest/epochs?uploadStartTimeInSeconds=1444937651&uploadEndTimeInSeconds=144493 7902”}]}’ http://localhost:8080/garmin/ping

I have no idea how to write it in postman, I have the header this is ok, then we have other value after the -d, don't know where to put it...

I have tried to import the cURL using the import function as in postman but it gives me :

Error while importing Curl: arg.startsWith is not a function

Solution

  • You need to use proper quotation marks, " and ' instead of , , and .

    This is working:

    curl -v -X POST -H "Content-Type: application/json;charset=utf-8" -d '{"epochs":[{"userAccessToken":"8f57a6f1-26ba-4b05-a7cd- c6b525a4c7a2","uploadStartTimeInSeconds":1444937651,"uploadEndTimeInSeconds":1444 937902,"callbackURL":"https://healthapi.garmin.com/wellness- api/rest/epochs?uploadStartTimeInSeconds=1444937651&uploadEndTimeInSeconds=144493 7902"}]}' http://localhost:8080/garmin/ping