Skip to content

s0phi4/ulink-to-code-api

Repository files navigation

General Assembly Logo

ULink to Code store API

Links

A full stack web app for coders of all times to save their coding online resources!

API

Verb URI Pattern Controller#Action
POST /sign-up users#signup
POST /sign-in users#signin
PATCH /change-password/:id users#changepw
DELETE /sign-out/:id users#signout
POST /resources resources#create
GET /resources resources#index
PATCH /resources/:id resources#update
DELETE /resources/:id resources#destroy

Actions

Requests:

curl "${API}${URL_PATH}" \
  --include \
  --request POST \
  --header "Authorization: Token token=$TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "resource": {
      "name": "'"${NAME}"'",
      "url": "'"${URL}"'",
      "tag": "'"${TAG}"'",
      "content_type": "'"${CONTENT_TYPE}"'"
    }
  }'

Request:

API="${API_ORIGIN:-http://localhost:4741}"
URL_PATH="/resources"
curl "${API}${URL_PATH}" \
  --include \
  --request GET \
  --header "Authorization: Token token=$TOKEN"

Request:

curl "${API}${URL_PATH}" \
  --include \
  --request PATCH \
  --header "Authorization: Token token=$TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "resource": {
      "name": "'"${NAME}"'",
      "url": "'"${URL}"'"
    }
  }'

Request:

curl "${API}${URL_PATH}" \
--include \
--request DELETE \
--header "Authorization: Token token=$TOKEN"

Process developing

I developed this API step by step and use sh to run every script I was creating to see the error and then work on the error I was given. I chose not to scaffold in order to understand the process and to have a methodical organized API development.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published