2016-09-09 22 views
0

有沒有辦法讓API Blueprint的POST請求接受任何值?使用API​​ Blueprint接受POST JSON中的任何值

現在我有:

### Google [POST] 
Login with Google 

+ token (string) - google token 

+ Request (application/json) 
     { 
      "token": "google" 
     } 

+ Response 200 (application/json) 
     { 
     "token": "xyz", 
     } 

而且從完全一樣的身體沒有分開的描述是由Drakov消耗。

+0

您的參數可能導致問題。令牌(字符串)可以設置爲可選。而且,我認爲'token'不僅僅是一個參數。就我對API藍圖的理解而言,Paramters是URL的一部分。我認爲你想要在身體參數。另外,你不把標記放在標題中嗎? – Vasif

回答

0

您可以使用模式,而不是硬編碼的值。

  • 請求(應用/ vnd.aconex.pdfmerge.job.v1.1 + JSON)

    • 集管

      Accept: application/vnd.pdfmerge.job.v1.1+json 
      
    • 架構

      { 
          "$schema": "http://json-schema.org/draft-04/schema#", 
          "type": "object", 
          "properties": { 
          "zipFilePath": { 
           "type": "string" 
          }, 
          "status": { 
           "type": "string" 
          }, 
          "mergedFilePath": { 
           "type": ["string", "null"] 
          }, 
          "id": { 
           "type": "string" 
          }, 
          "fileName": { 
           "type": "string" 
          } 
          }, 
          "required": [ 
          "zipFilePath", 
          "status", 
          "mergedFilePath", 
          "id", 
          "fileName" 
          ] 
      } 
      
相關問題