0

Im totally new in using curl or other submission services. As i'm following this link to submit an indoor map using wrld3d api they've stated the following line in order to submit a post request

$ curl -v -XPOST https://indoor-maps-api.wrld3d.com/v1/edits/?token=dev_auth_token -F name="my venue name" -F venue_street_address="<address>" -F venue_phone_number="<phone no.>" -F venue_email="<email address>" -F submission_contact_email="<email address for notifications>" -F venue_outline="@/path/to/my/file"

I tried filling in the values such as dev_auth_token with my respective account's developer token and other values like "my venue name","".. etc but i guess im going wrong as the command isn't running.Is there any syntax to follow? Here is how i filled up the command Command and here is the command after executing enter image description here

Ahmed Wael
  • 29
  • 11

1 Answers1

1

When your URI contains some data wrap it with double quota

$ curl -v -X POST "https://indoor-maps-api.wrld3d.com/v1/edits/?token=dev_auth_token&name=my venue name&venue_street_address=<address>&venue_phone_number=<phone no.>&venue_email=<email address>&submission_contact_email=<email address for notifications>&venue_outline=@/path/to/my/file"

Same here: CURL Command Line URL Parameters. You have just trouble with parameters. Also, ... you can try with your command but using -d (that stay for data) instead of -F.

  • -F, --form
  • (HTTP) This lets curl emulate a filled-in form in which a user has pressed the submit button. This causes curl to POST data using the Content-Type multipart/form-data according to RFC 2388. This enables uploading of binary files etc. To force the 'content' part to be a file, prefix the file name with an @ sign. To just get the content part from a file, prefix the file name with the symbol <. The difference between @ and < is then that @ makes a file get attached in the post as a file upload, while the < makes a text field and just get the contents for that text field from a file.

  • Example: to send an image to a server, where 'profile' is the name of the form-field to which portrait.jpg will be the input:

    • curl -F profile=@portrait.jpg https://example.com/upload.cgi
    • To read content from stdin instead of a file, use - as the filename. This goes for both @ and < constructs. Unfortunately it does not support reading the file from a named pipe or similar, as it needs the full size before the transfer starts.
    • You can also tell curl what Content-Type to use by using 'type=', in a manner similar to:
      • curl -F "web=@index.html;type=text/html" example.com or
      • curl -F "name=daniel;type=text/foo" example.com
    • You can also explicitly change the name field of a file upload part by setting filename=, like this:
      • curl -F "file=@localfile;filename=nameinpost" example.com
    • If filename/path contains ',' or ';', it must be quoted by double-quotes like:
      • curl -F "file=@\"localfile\";filename=\"nameinpost\"" example.com or
      • curl -F 'file=@"localfile";filename="nameinpost"' example.com
    • Note that if a filename/path is quoted by double-quotes, any double-quote or backslash within the filename must be escaped by backslash.
    • See further examples and details in the MANUAL.
    • This option can be used multiple times.
    • This option overrides -d, --data and -I, --head and --upload.
sensorario
  • 20,262
  • 30
  • 97
  • 159
  • i got the following errors `token is not recognized an internal or external command,operable program or hatch file` & `venue_street_address is not recognized an internal or external command,operable program or hatch file` – Ahmed Wael Apr 05 '18 at 00:29
  • Actually i didn't understand much would you please give me an example of how to write the command? – Ahmed Wael Apr 05 '18 at 17:03
  • Thats how i wrote it: `curl -k -X POST "https://indoor-maps-api.wrld3d.com/v1/edits/?put=token&"5919cd32ec96a905c3f8ad2ae21a5548f2073e0e53d68ec33fd4e034b391102432474eea6438fc35"-F name="myhome" -F venue_street_address="egypt" -F venue_phone_number="00201011854060" -F venue_email="iahmedwael@gmail.com" -F submission_contact_email="iahmedwael@gmail.com" -F venue_outline="C:\Users\Ahmed\Desktop\myhomeindoormap"" ` – Ahmed Wael Apr 05 '18 at 23:23