1

JSON 投稿リクエストを使用してプロジェクトのドキュメントを作成しようとしています。
get リクエストでは、uri パラメータを簡単に定義できます。

ただし、json やその他の投稿リクエストについても同じことを行いたいと考えています。
私はそれが以下のように機能することを望んでいました.例にパラメータを表示しますが、それを行う方法ではないようです...
これを適切に行う方法はありますか?

## Post Inbound [/ws/3/inbound]
### Post Inbound [POST]


+ Request

        {
            "authentication":
                {
                    "location":"{location}",
                    "customer_id":{customer_id},
                    "context":"{context}"
                },
            "date":"",
            "reference":"",
            "details":
            [
                {
                    "article_code":"",
                    "qty_expected":
                },
                {
                    "article_code":"",
                    "qty_expected":
                }
            ]
        }

+ Parameters
    + location (required, string) - Target url of the wics server 
    + customer_id (required, int) - Customer ID
    + context (required, string) - Authentication context gotten from login
    + date (required, date) - Date format as yyyy-mm-dd
    + reference (required, string) - Reference
    + article_code (required, string) - Article code
    + qty_expected (required, int) - Quantity expected.
4

1 に答える 1

5

Parametersキーワードは、API ブループリントでURI パラメーターを示すためのものであり、属性キーワードは、要求または応答本文中に指定された属性などを示すためのものです。

これは、リクエストに対して次のようになります。

## Post Inbound [/ws/3/inbound]
### Post Inbound [POST]

+ Request (application/json)

    + Attributes
        + authentication (required, object)
            + location (required, string) - Target url of the wics server 
            + customer_id (required, number) - Customer ID
            + context (required, string) - Authentication context gotten from login
        + date: `2015-12-30` (required, string) - Date format as yyyy-mm-dd
        + reference (required, string) - Reference
        + details (required, array)
            + (object)
                + article_code (required, string) - Article code
                + qty_expected (required, number) - Quantity expected.

+ Response 204

そして、Apiary でそのようにレンダリングされます。

MSON は Apiary で拡張およびレンダリングされました

MSON (API ブループリントで使用されるオブジェクト表記の構文) の完全な仕様は、https://github.com/apiaryio/msonにあります。

于 2015-07-14T19:26:00.420 に答える