[Greeneeds] API Documentation

그냥·2022년 7월 9일
0

django

목록 보기
18/20

User

1. 로그인

request

METHOD : POST
HOST   : IP:PORT/users/signin/kakao
BODY   : 
{
	"code" : char_type
}

response

  • 201
{"token" : access_token}
  • 400
{"message" : "KEY_ERROR"}



2. 유저 정보 전달

request

METHOD : GET
HOST   : IP:PORT/users
HEADERS :
{
	"Authorization" : token
}

response

  • 200
{
    "result": {
        "user_id"  : int_type,
        "nickname" : char_type,
        "email"    : char_type
    }
}



3-1. 좋아요 POST

request

METHOD  : POST
HOST    : IP:PORT/users/like
HEADERS :
{
	"Authorization" : token
}
BODY 	: 
{
	"project_id" : int_type
}

response

  • 201
{
    "message": "SUCCESS",
    "like_count": 1
}
  • 400
{
    "message": "KEY_ERROR"
}



3-2. 좋아요 GET

request

METHOD  : GET
HOST    : IP:PORT/users/like
HEADERS :
{
	"Authorization" : token
}

response

  • 200
{
    "result": [
        {
            "user_id": int_type,
            "project_id": int_type,
            "thumbnail": char_type,
            "category": char_type,
            "title": char_type,
            "summary": char_type,
            "total_amount": int_type,
            "remain_days": int_type
        },
        {
            "user_id": int_type,
            "project_id": int_type,
            "thumbnail": char_type,
            "category": char_type,
            "title": char_type,
            "summary": char_type,
            "total_amount": int_type,
            "remain_days": int_type
        },
    ]
}



Project

1-1. 프로젝트 올리기

request

METHOD  : POST
HOST	: IP:PORT/projects
HEADERS : {"Authorization" : token}
BODY	: 
{
     "formData"		   : img_file,
     "category"        : int_type,
     "title"           : char_type,
     "summary"         : char_type,
     "target_amount"   : datetime_type,
     "start_datetime"  : datetime_type,
     "end_datetime"    : datetime_type,
 }


category의 value값은 아래 테이블를 참고하여 id 값으로 요청한다.

id      name
1       쥬얼리
2       의류
3       신발
4       가방

ex)
{
     "category"        : 1 #카테고리가 쥬얼리인 경우,
     "title"           : "사파이어 링",
     ...
}

response

  • 201
{
	'message' : 'PROJECT_CREATED'
}
  • 400
{
    'message' : 'KEY_ERROR'
}



2. 메인 페이지 프로젝트 리스트

request

METHOD  : GET
HOST    : IP:PORT/projects?order={likes or recent or random}
정렬
좋아요순 : order=likes
최신순  : order=recent
랜덤순  : order=random

response

  • 200
{
    "results": [
        {
            "id": int_type,
            "thumbnail": char_type,
            "category": char_type,
            "title": char_type,
            "summary": char_type,
            "target_amount": int_type,
            "remain_days": int_type,
            "date": YYYY-MM-DD,
            "like_count": int_type
        },
        {
            "id": int_type,
            "thumbnail": char_type,
            "category": char_type,
            "title": char_type,
            "summary": char_type,
            "target_amount": int_type,
            "remain_days": int_type,
            "date": YYYY-MM-DD,
            "like_count": int_type
        },
        {
            "id": int_type,
            "thumbnail": char_type,
            "category": char_type,
            "title": char_type,
            "summary": char_type,
            "target_amount": int_type,
            "remain_days": int_type,
            "date": YYYY-MM-DD,
            "like_count": int_type
        },
        {
            "id": int_type,
            "thumbnail": char_type,
            "category": char_type,
            "title": char_type,
            "summary": char_type,
            "target_amount": int_type,
            "remain_days": int_type,
            "date": YYYY-MM-DD,
            "like_count": int_type
        },
        
        ...
    ]
}



3. 상세 페이지

request

METHOD  : GET
HOST    : IP:PORT/projects/<int_type>

response

  • 200
{
    "results": {
        "id": int_type,
        "thumbmail": char_type,
        "category": char_type,
        "title": char_type,
        "like_count": int_type,
        "target_amount": int_type,
        "price": int_type,
        "start_datetime": YYYY-MM-DD,
        "end_datetime": YYYY-MM-DD,
        "pay_end_date": YYYY-MM-DD,
        "settlement_date": YYYY-MM-DD,
        "introduction": char_type,
        "total_amount": int_type,
        "organizations": [
            {
                "id": int_type,
                "name": char_type
            },
            {
                "id": int_type,
                "name": char_type
            },
            {
                "id": int_type,
                "name": char_type
            }
        ],
        "images": [
            {
                "id": int_type,
                "url": char_type
            },
            {
                "id": int_type,
                "url": char_type
            }
        ],
        "remain_days": int_type
    }
}


0개의 댓글

관련 채용 정보