Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curl Request format should be updated #19

Open
danman01 opened this issue Apr 4, 2017 · 5 comments
Open

Curl Request format should be updated #19

danman01 opened this issue Apr 4, 2017 · 5 comments

Comments

@danman01
Copy link

danman01 commented Apr 4, 2017

These requests in the readme should be written the same way as rails-api-template's curl requests so that we are consistent: https://github.com/ga-wdi-boston/rails-api-template

new:

curl http://localhost:4741/sign-up \
  --include \
  --request POST \
  --header "Content-Type: application/json" \
  --data '{
    "credentials": {
      "email": "'"${EMAIL}"'",
      "password": "'"${PASSWORD}"'",
      "password_confirmation": "'"${PASSWORD}"'"
    }
  }'

[email protected] PASSWORD=hannah scripts/sign-up.sh

old:

curl --include --request POST http://localhost:4741/sign-up \
  --header "Content-Type: application/json" \
  --data '{
    "credentials": {
      "email": "[email protected]",
      "password": "an example password",
      "password_confirmation": "an example password"
    }
  }'
@gaand
Copy link

gaand commented Apr 4, 2017

Should they reflect the API and URL_PATH from the scripts?

@danman01
Copy link
Author

danman01 commented Apr 4, 2017

Or in the readme could we just link to the scripts?

So for POST /sign-up, we currently have:

Request:

curl http://localhost:4741/sign-up \
  --include \
  --request POST \
  --header "Content-Type: application/json" \
  --data '{
    "credentials": {
      "email": "'"${EMAIL}"'",
      "password": "'"${PASSWORD}"'",
      "password_confirmation": "'"${PASSWORD}"'"
    }
  }'
[email protected] PASSWORD=hannah scripts/sign-up.sh

To get code out of readme and keep consistent with scripts, we could have:

Request:
view sign up curl request

Run with [email protected] PASSWORD=myPass scripts/sign-up.sh

@gaand
Copy link

gaand commented Apr 6, 2017

I think I suggested that at one point to @jrhorn424 and I believe he objected.

@jrhorn424
Copy link
Contributor

@gaand @danman01 Since we're moving toward inlining code with magic comments, I'll formally remove my objection. I no longer have a strong preference.

My objection was principled in that documentation examples are not the same thing as scripts. For example:

  • The Instagram API does not even provide example scripts.
  • The twilio API offers example requests, but does not offer an opinion on how a script should be structured.

I also realize that a talk intended to teach is different than documentation, but would also point out that one of the skills we want them to develop is reading documentation. Perhaps re-coding toward a well-factored script should be done starting with a copypasta script from the README on a tutorial branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants