0

I'm working on some curl command api and I want to convert them to javascript. Where can I learn how to convert them to javascript?

curl -v -X PUT -H "Content-Type: application/json"
-H "Accept: application/json" -X PUT --user myusername:mypassword
https[..to a specific location..] -d 
"{\"name\": \"Marcus0.1\",\"start\": 500000,\"end\": 1361640526000}"

Thanks

1
  • What kind of Javascript request? Server-side? Client-side? AJAX? Can you post some code for what you've tried? Commented Aug 5, 2013 at 21:17

1 Answer 1

2

There are many ways to accomplish this in Javascript depending on the environment. At a higher level, here's what that curl command is doing.

  • Using the HTTP PUT method
  • Setting a Content-Type header to application/json
  • Adding a Authorization header for the username and password specified (see Client side here for more details on the wire format)
  • Setting the request body to the JSON specified after the -d parameter
  • Sending that all to the URL specified
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.