yeahgdev
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # URLSession에 대해서 설명하시오. URL로 데이터를 다운로드, 업로드 할 수 있는, 애플에서 제공하는 통신 API 입니다. HTTP 통신 프로토콜을 사용하기 때문에 동일하게 Request와 Response 구조로 되어있습니다. * Request: `URL 객체를 통해 직접 통신`하거나 `URLRequest 객체에 옵션을 부여`하여 통신한다. * Response: `설정된 Task의 Completion Handler 형태로 response를 받`거나, `URLSessionDelegate를 통해 지정된 메서드를 호출하는 형태로 response를 받`는다. ### URLSessionConfiguration의 종류 1. `Default Session`: 기본적인 Session으로 디스크 기반 캐싱을 지원합니다. 2. `Ephemeral Session`: 어떠한 데이터도 저장하지 않는 형태의 세션입니다. 3. `Background Session`: 앱이 종료된 이후에도 통신이 이뤄지는 것을 지원하는 세션입니다. ### URLSessionTask의 종류 1. `URLSessionDataTask`: 기본적인 데이터를 받는 경우, response데이터를 메모리 상에서 처리 2. `URLSessionUploadTask`: 파일 업로드 시 사용, 사용하기 편한 request body 제공 3. `URLSessionDownloadTask`: 실제 파일을 다운받아 디스크에 사용될때 사용 ### SessionDelegate 는 무엇인가요? Session의 task들은 공통된 delegate를 공유합니다. Seesion 레벨의 이벤트, Session life cycle 변화시 호출되는 메서드를 정의하고 있습니다. 기본적으로는 설정된 Task의 Completion Handler 형태로 response를 처리하게 된다. 그렇지 않고 Delegate를 사용하는 경우는 아래와 같다. * 앱이 background 상태로 들어갈 때에도 파일 다운로드를 지원하도록 설정하고 싶을 때 * 인증과 캐싱을 default 옵션으로 사용하지 않을 때 * task의 데이터 전송이 완료된 시점 핸들러를 구현하고 싶을 때 ### URLSession의 기본 Life Cycle 1. Session configuration을 결정하고, Session을 생성한다. 2. 통신할 URL과 Request 객체를 설정한다. 3. 사용할 Task를 결정하고, 그에 맞는 Completion Handler나 Delegate 메소드들을 작성한다. 4. 해당 Task를 실행한다. 5. Task 완료 후 Completion Handler가 실행된다. ### 어떤 Thread에서 Task를 진행해야 하나요? URLSession API는 thread-safe하기 때문에 어떤 쓰레드를 사용하여도 무방합니다. # REST API에 대해 설명하시오. Representational State Transfer API. REST 소프트웨어 아키텍쳐를 준수한 API를 REST API, Restful API라고 말합니다. REST 아키텍쳐는 클라이언트, 서버간 정보를 안전하고 효율적으로 교환하기 위한 규칙을 정의하고 있습니다. 이를 구현한 RESTful API는 유연하고 확장가능한 API로 다른 애플리케이션, 서버와 통신시 많이 사용되고 있습니다. RESTful API는 아래 6가지 기준을 준수해야합니다. 1. **균일한 인터페이스** : 표준 형식으로 정보를 송수신합니다. 균일한 인터페이스에는 4가지 아키텍처 제약 조건이 있습니다. 1. **자원의 식별** : 요청은 리소스를 식별해야 합니다. 이를 위해 균일한 리소스 식별자(URI)를 사용합니다. 2. **메시지를 통한 리소스의 조작** : 클라이언트는 원하는 경우 리소스를 수정하거나 삭제하기에 충분한 정보를 리소스 표현에서 가지고 있습니다. 서버는 리소스를 자세히 설명하는 메타데이터를 전송하여 이 조건을 충족합니다. 3. **자기서술적 메시지** : 각 메시지는 자신을 어떻게 처리해야 하는지에 대한 충분한 정보를 포함해야 한다. 이를 위해 서버는 클라이언트가 리소스를 적절하게 사용할 수 있는 방법에 대한 메타데이터가 포함된 명확한 메시지를 전송합니다. 4. **애플리케이션의 상태에 대한 엔진으로서 하이퍼미디어** : 클라이언트는 작업을 완료하는 데 필요한 다른 모든 관련 리소스에 대한 정보를 수신합니다. 이를 위해 서버는 클라이언트가 더 많은 리소스를 동적으로 검색할 수 있도록 표현에 하이퍼링크를 넣어 전송합니다. 3. **무상태** : 각 요청 간 클라이언트의 정보가 서버에 저장되지 않습니다. 따라서 각 요청이 분리되어 있고 서로 연결되어 있지 않습니다. 4. **계층화 시스템** : 요청된 정보를 검색하는 데 관련된 서버(보안, 로드 밸런싱 등을 담당)의 각 유형을 여러 계층으로 계층화하고, 클라이언트가 볼 수 없는 상태로 유지합니다. 5. **캐시 가능성** 서버 응답 시간을 개선하기 위해 클라이언트 또는 중개자에 일부 응답을 저장하는 캐싱을 지원합니다. 6. **온디맨드 코드** : 요청을 받으면 서버에서 클라이언트로 실행 가능한 코드를 전송하여 클라이언트 기능을 확장할 수 있는 기능. ### REST API의 장점은? 확장가능하고 유연한 API를 설계할 수 있습니다. - 무상태는 서버가 과거 클라이언트 요청 정보를 유지할 필요가 없기 때문에 서버 로드를 제거합니다. 잘 관리된 캐싱은 일부 클라이언트-서버 상호 작용을 부분적으로 또는 완전히 제거해 효율적입니다. 이러한 모든 기능은 성능을 저하시키는 통신 병목 현상을 일으키지 않으면서 확장성을 지원합니다. - RESTful 웹 서비스는 완전한 **클라이언트-서버 분리**를 지원합니다. 각 부분이 독립적으로 발전할 수 있도록 다양한 서버 구성 요소를 단순화하고 분리합니다. 서버 애플리케이션의 플랫폼 또는 기술 변경은 클라이언트 애플리케이션에 영향을 주지 않습니다. - REST API는 사용되는 기술과 독립성을 유지합니다. API 설계에 영향을 주지 않고 다양한 프로그래밍 언어로 클라이언트 및 서버 애플리케이션을 모두 작성할 수 있습니다. ### RESTful API 클라이언트 요청에는 무엇이 포함되어 있나요? RESTful API에는 다음과 같은 주요 구성요소를 포함하는 요청이 필요합니다. **고유 리소스 식별자** 서버는 고유한 리소스 식별자로 각 리소스를 식별합니다. REST 서비스의 경우 서버는 일반적으로 URL(Uniform Resource Locator)을 사용하여 리소스 식별을 수행합니다. URL은 리소스에 대한 경로를 지정합니다. URL은 웹페이지를 방문하기 위해 브라우저에 입력하는 웹 사이트 주소와 유사합니다. URL은 요청 엔드포인트라고도 하며 클라이언트가 요구하는 사항을 서버에 명확하게 지정합니다. **메서드** 개발자는 종종 Hypertext Transfer Protocol(HTTP)을 사용하여 RESTful API를 구현합니다. HTTP 메서드는 리소스에 수행해야 하는 작업을 서버에 알려줍니다. GET, POST, PUT, DELETE ### REST API의 기본 수행 기능 * Create: POST 요청을 사용하여 리소스를 생성 * Read: GET 요청을 사용하여 리소스를 검색 * Update: PUT 요청을 사용하여 리소스를 업데이트 * Delete: DELETE 요청을 사용하여 리소스를 삭제 **HTTP 헤더** 요청 헤더는 클라이언트와 서버 간에 교환되는 메타데이터입니다. 예를 들어, 요청 헤더는 요청 및 응답의 형식을 나타내고 요청 상태 등에 대한 정보를 제공합니다. * 데이터 REST API 요청에는 POST, PUT 및 기타 HTTP 메서드가 성공적으로 작동하기 위한 데이터가 포함될 수 있습니다. * 파라미터 RESTful API 요청에는 수행해야 할 작업에 대한 자세한 정보를 서버에 제공하는 파라미터가 포함될 수 있습니다. 다음은 몇 가지 파라미터 유형입니다. URL 세부정보를 지정하는 경로 파라미터. 리소스에 대한 추가 정보를 요청하는 쿼리 파라미터. 클라이언트를 빠르게 인증하는 쿠키 파라미터. ### Response로 돌아오는 상태코드를 종류별로 설명해주세요 200: 일반 성공 응답 201: POST 메서드 성공 응답 400: 서버가 처리할 수 없는 잘못된 요청 404: 리소스를 찾을 수 없음 5XX: 서버 오류 참고링크: https://aws.amazon.com/ko/what-is/restful-api/

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully