Back to top

全數 API 之 URL 皆有 /api 前綴,如:http://vuse.tw/api/eggs/1

以下 URL 將省略 /api 前綴。

Eggs 

想法蛋之 API。

Egg 

想法蛋之 status 狀態有 'new', 'pending', 'hatched''discarded' 四種,皆可由此 API 取得。注意 status = 'new' || 'discarded' 的想法蛋,應該只有作者本人或 superadmin 可以存取。

取得單一想法蛋GET /eggs/:id

is_anonymous 決定想法蛋是否匿名。輸出 JSON 時,匿名想法蛋的 client_id 固定為 null

  • Parameters
  • id
    string (required) Example: 1-hoping-never-fall

    想法蛋 slug / ID

    list
    string (optional) Example: designer

    欄位列表,以 , 分隔。 根據此處列出的欄位,從「欄位和此想法蛋相同」的想法蛋中,選出「前一個」和「下一個」想法蛋。 例:list=designer 時,會選出和當前想法蛋之設計師相同的想法蛋。

    若為 no,則 response 內不含 prevnext

    Choices: collect, channel, designer, client

    item
    string (optional) Example: 3

    ID 若 list 中含有 collect,則 ID 需為「收藏此想法蛋之使用者 ID」。 若 list 中含有 channel,則 ID 需為「頻道 ID」。

  • Response  200Toggle
  • Body
    {
        egg: {
            client_id: 54, /* 若 `is_anonymous` 為 true 則此欄為 `null` */
            collector_count: 2,
            color: "#444",
            concept: "這是電影inception(全面啟動)的圖騰,在夢裡可以一直轉動而不會倒。夢總是讓人迷惑,而且往往和現實相背,不是嗎?",
            concept_eng: "This is the totem of movie (inception), in the dream it can spin all day and never fall. Dreams always confuse us and always in contract with the fact.",
            created_at: "2010-08-20T17:35:00+08:00",
            designer_id: 1,
            id: 1,
            image: {
                url: "/uploads/egg/image/1/e4e4292.jpg",
                thumbnail: {
                    url: "/uploads/egg/image/1/thumbnail_e4e4292.jpg"
                },
                square: {
                    url: "/uploads/egg/image/1/square_e4e4292.jpg"
                }
            },
            is_anonymous: false,
            nickname: "柯柏",
            offset_x: -23,
            offset_y: -166,
            order: 1,
            payload: { },
            reply_count: 0,
            slug: "hoping-never-fall",
            spice: "懷疑",
            spice_eng: "doubt",
            status: "hatched",
            title: "Hoping never fall",
            title_eng: "Hoping never fall",
            updated_at: "2010-08-20T17:35:00+08:00",
            view: "人人都希望永遠不倒,但永遠不倒終就只是個夢。",
            view_eng: "Everyone wants never fall, but having no fall is a dream.",
            client: {
                avatar: {
                    url: null,
                    small: {
                        url: null
                    },
                    square: {
                        url: null
                    }
                },
                penname: "柯柏",
                slug: "柯柏"
            },
            designer: {
                avatar: {
                    url: "/uploads/user/avatar/1/3b1fae2.jpg",
                    small: {
                        url: "/uploads/user/avatar/1/small_3b1fae2.jpg"
                    },
                    square: {
                        url: "/uploads/user/avatar/1/square_3b1fae2.jpg"
                    }
                },
                penname: "Vuse Meiling",
                slug: "vuse-meiling"
            },
            tags: [
                {
                    id: 926,
                    created_at: "2014-02-11T01:51:36+08:00",
                    user_id: 1,
                    channel_id: 15,
                    channel: {
                        slug: "想像",
                        title: "想像"
                    }
                }
            ]
        },
        prev: "吞下傷感",
        next: "路平專暗",
        related: [
            {
                slug: "le-bon-chemin",
                image: "/uploads/egg/image/833/square_957e970.jpg"
            },
            {
                slug: "breads-vacation",
                image: "/uploads/egg/image/482/square_1d265d8.jpg"
            },
            {
                slug: "鏡--2",
                image: "/uploads/egg/image/664/square_7a74e3e.jpg"
            },
            {
                slug: "出離",
                image: "/uploads/egg/image/822/square_80fe9d6.jpg"
            },
            {
                slug: "宇宙的秘密",
                image: "/uploads/egg/image/1321/square_26141b0.jpg"
            },
            {
                slug: "isolation",
                image: "/uploads/egg/image/647/square_97ce14c.jpg"
            },
            {
                slug: "breaking-dawn",
                image: "/uploads/egg/image/992/square_4d9bb04.jpg"
            }
        ]
    }
    
更新單一想法蛋PUT /eggs/:id

必須要是此想法蛋的設計師,才能更新想法。

  • Parameters
  • title
    string (required) 
  • Response  200Toggle
  • Headers
    Content-Type: application/json
    Body
    {
        client_id: 54, /* 若 `is_anonymous` 為 true 則此欄為 `null` */
        collector_count: 2,
        color: "#444",
        concept: "這是電影inception(全面啟動)的圖騰,在夢裡可以一直轉動而不會倒。夢總是讓人迷惑,而且往往和現實相背,不是嗎?",
        concept_eng: "This is the totem of movie (inception), in the dream it can spin all day and never fall. Dreams always confuse us and always in contract with the fact.",
        created_at: "2010-08-20T17:35:00+08:00",
        designer_id: 1,
        id: 1,
        image: {
            url: "/uploads/egg/image/1/e4e4292.jpg",
            thumbnail: {
                url: "/uploads/egg/image/1/thumbnail_e4e4292.jpg"
            },
            square: {
                url: "/uploads/egg/image/1/square_e4e4292.jpg"
            }
        },
        is_anonymous: false,
        nickname: "柯柏",
        offset_x: -23,
        offset_y: -166,
        order: 1,
        payload: { },
        reply_count: 0,
        slug: "hoping-never-fall",
        spice: "懷疑",
        spice_eng: "doubt",
        status: "hatched",
        title: "Hoping never fall",
        title_eng: "Hoping never fall",
        updated_at: "2010-08-20T17:35:00+08:00",
        view: "人人都希望永遠不倒,但永遠不倒終就只是個夢。",
        view_eng: "Everyone wants never fall, but having no fall is a dream.",
        client: {
            avatar: {
                url: null,
                small: {
                    url: null
                },
                square: {
                    url: null
                }
            },
            penname: "柯柏",
            slug: "柯柏"
        },
        designer: {
            avatar: {
                url: "/uploads/user/avatar/1/3b1fae2.jpg",
                small: {
                    url: "/uploads/user/avatar/1/small_3b1fae2.jpg"
                },
                square: {
                    url: "/uploads/user/avatar/1/square_3b1fae2.jpg"
                }
            },
            penname: "Vuse Meiling",
            slug: "vuse-meiling"
        },
        tags: [
            {
                id: 926,
                created_at: "2014-02-11T01:51:36+08:00",
                user_id: 1,
                channel_id: 15,
                channel: {
                    slug: "想像",
                    title: "想像"
                }
            }
        ]
    }
    

說書人送出想法蛋 

說書人送出想法蛋POST /eggs/

送出新想法時,若沒有登入,會回傳 401。若資料有物,會回傳 422。

  • Parameters
  • egg
    object (required) 

    想法蛋物件。

    egg.is_anonymous
    boolean (required) Example: false

    是否要匿名。

    egg.nickname
    text (required) 

    匿名想法蛋的暱稱。

    egg.spice
    text (required) 

    情緒調味料。

    egg.view
    text (required) 

    想說的話。

    egg.payload
    object (optional) 

    補充資料,請見下圖。 Imgur

    hue
    number (required) 

    想法蛋色相,0~360

    channels
    array (optional) Example: [1,3,6]

    想法蛋收錄頻道 ID。

  • RequestToggle
  • Headers
    Content-Type: application/json
    Body
    {"egg":{"is_anonymous":false,"nickname":"MrOrz","spice":"情緒調味料","view":"想說的話喔"},"hue":83.23529411764706,"channels":[24,27]}
    
  • Response  200Toggle
  • Headers
    Content-Type: application/json
    Body
    {
        client_id: 54, /* 若 `is_anonymous` 為 true 則此欄為 `null` */
        collector_count: 2,
        color: "#444",
        concept: "這是電影inception(全面啟動)的圖騰,在夢裡可以一直轉動而不會倒。夢總是讓人迷惑,而且往往和現實相背,不是嗎?",
        concept_eng: "This is the totem of movie (inception), in the dream it can spin all day and never fall. Dreams always confuse us and always in contract with the fact.",
        created_at: "2010-08-20T17:35:00+08:00",
        designer_id: 1,
        id: 1,
        image: {
            url: "/uploads/egg/image/1/e4e4292.jpg",
            thumbnail: {
                url: "/uploads/egg/image/1/thumbnail_e4e4292.jpg"
            },
            square: {
                url: "/uploads/egg/image/1/square_e4e4292.jpg"
            }
        },
        is_anonymous: false,
        nickname: "柯柏",
        offset_x: -23,
        offset_y: -166,
        order: 1,
        payload: { },
        reply_count: 0,
        slug: "hoping-never-fall",
        spice: "懷疑",
        spice_eng: "doubt",
        status: "hatched",
        title: "Hoping never fall",
        title_eng: "Hoping never fall",
        updated_at: "2010-08-20T17:35:00+08:00",
        view: "人人都希望永遠不倒,但永遠不倒終就只是個夢。",
        view_eng: "Everyone wants never fall, but having no fall is a dream.",
        client: {
            avatar: {
                url: null,
                small: {
                    url: null
                },
                square: {
                    url: null
                }
            },
            penname: "柯柏",
            slug: "柯柏"
        },
        designer: {
            avatar: {
                url: "/uploads/user/avatar/1/3b1fae2.jpg",
                small: {
                    url: "/uploads/user/avatar/1/small_3b1fae2.jpg"
                },
                square: {
                    url: "/uploads/user/avatar/1/square_3b1fae2.jpg"
                }
            },
            penname: "Vuse Meiling",
            slug: "vuse-meiling"
        },
        tags: [
            {
                id: 926,
                created_at: "2014-02-11T01:51:36+08:00",
                user_id: 1,
                channel_id: 15,
                channel: {
                    slug: "想像",
                    title: "想像"
                }
            }
        ]
    }
    
  • Response  401Toggle
  • Body
    {
        error: "Should login first"
    }
    
  • Response  422Toggle
  • Headers
    Content-Type: application/json
    Body
    {
        client_id: 54, /* 若 `is_anonymous` 為 true 則此欄為 `null` */
        collector_count: 2,
        color: "#444",
        concept: "這是電影inception(全面啟動)的圖騰,在夢裡可以一直轉動而不會倒。夢總是讓人迷惑,而且往往和現實相背,不是嗎?",
        concept_eng: "This is the totem of movie (inception), in the dream it can spin all day and never fall. Dreams always confuse us and always in contract with the fact.",
        created_at: "2010-08-20T17:35:00+08:00",
        designer_id: 1,
        id: 1,
        image: {
            url: "/uploads/egg/image/1/e4e4292.jpg",
            thumbnail: {
                url: "/uploads/egg/image/1/thumbnail_e4e4292.jpg"
            },
            square: {
                url: "/uploads/egg/image/1/square_e4e4292.jpg"
            }
        },
        is_anonymous: false,
        nickname: "柯柏",
        offset_x: -23,
        offset_y: -166,
        order: 1,
        payload: { },
        reply_count: 0,
        slug: "hoping-never-fall",
        spice: "懷疑",
        spice_eng: "doubt",
        status: "hatched",
        title: "Hoping never fall",
        title_eng: "Hoping never fall",
        updated_at: "2010-08-20T17:35:00+08:00",
        view: "人人都希望永遠不倒,但永遠不倒終就只是個夢。",
        view_eng: "Everyone wants never fall, but having no fall is a dream.",
        client: {
            avatar: {
                url: null,
                small: {
                    url: null
                },
                square: {
                    url: null
                }
            },
            penname: "柯柏",
            slug: "柯柏"
        },
        designer: {
            avatar: {
                url: "/uploads/user/avatar/1/3b1fae2.jpg",
                small: {
                    url: "/uploads/user/avatar/1/small_3b1fae2.jpg"
                },
                square: {
                    url: "/uploads/user/avatar/1/square_3b1fae2.jpg"
                }
            },
            penname: "Vuse Meiling",
            slug: "vuse-meiling"
        },
        tags: [
            {
                id: 926,
                created_at: "2014-02-11T01:51:36+08:00",
                user_id: 1,
                channel_id: 15,
                channel: {
                    slug: "想像",
                    title: "想像"
                }
            }
        ]
    }
    

設計師發佈想法蛋 

設計師發佈想法蛋POST /eggs/:id/publish

目前登入之使用者,必須要有「設計師」身分(:designer in roles)才能發佈想法蛋。

  • Parameters
  • title
    string (required) 
  • Response  200Toggle
  • Headers
    Content-Type: application/json
    Body
    {
        client_id: 54, /* 若 `is_anonymous` 為 true 則此欄為 `null` */
        collector_count: 2,
        color: "#444",
        concept: "這是電影inception(全面啟動)的圖騰,在夢裡可以一直轉動而不會倒。夢總是讓人迷惑,而且往往和現實相背,不是嗎?",
        concept_eng: "This is the totem of movie (inception), in the dream it can spin all day and never fall. Dreams always confuse us and always in contract with the fact.",
        created_at: "2010-08-20T17:35:00+08:00",
        designer_id: 1,
        id: 1,
        image: {
            url: "/uploads/egg/image/1/e4e4292.jpg",
            thumbnail: {
                url: "/uploads/egg/image/1/thumbnail_e4e4292.jpg"
            },
            square: {
                url: "/uploads/egg/image/1/square_e4e4292.jpg"
            }
        },
        is_anonymous: false,
        nickname: "柯柏",
        offset_x: -23,
        offset_y: -166,
        order: 1,
        payload: { },
        reply_count: 0,
        slug: "hoping-never-fall",
        spice: "懷疑",
        spice_eng: "doubt",
        status: "hatched",
        title: "Hoping never fall",
        title_eng: "Hoping never fall",
        updated_at: "2010-08-20T17:35:00+08:00",
        view: "人人都希望永遠不倒,但永遠不倒終就只是個夢。",
        view_eng: "Everyone wants never fall, but having no fall is a dream.",
        client: {
            avatar: {
                url: null,
                small: {
                    url: null
                },
                square: {
                    url: null
                }
            },
            penname: "柯柏",
            slug: "柯柏"
        },
        designer: {
            avatar: {
                url: "/uploads/user/avatar/1/3b1fae2.jpg",
                small: {
                    url: "/uploads/user/avatar/1/small_3b1fae2.jpg"
                },
                square: {
                    url: "/uploads/user/avatar/1/square_3b1fae2.jpg"
                }
            },
            penname: "Vuse Meiling",
            slug: "vuse-meiling"
        },
        tags: [
            {
                id: 926,
                created_at: "2014-02-11T01:51:36+08:00",
                user_id: 1,
                channel_id: 15,
                channel: {
                    slug: "想像",
                    title: "想像"
                }
            }
        ]
    }
    

Egg List 

Get EggsGET /eggs

未孵化想法蛋列表

  • Response  200

Generated by aglio on 01 May 2014