百度智能云

All Product Document

          API Gateway

          Step 3 Call API

          1.When calling the API, we should splice the signature strings. Now the authentication method is the APP authentication. We should use AppKey and AppSecret for signature computation.

          2.When the signed string X-Bce-Signature is put in the request header, the gateway verifies the identity of the requester by the symmetric signature computation.

          3.According to different authentication methods, the corresponding calculated signature is passed in the request Header. The input parameter information is generated into signature strings according to the request signature description. Only in this way can the request of the verification succeed.

          Request Signature Description

          1.Related Header

          Request header Parameter description
          X-Bce-Signature For the signature strings, please refer to the Signature Verification Document for details.
          X-Bce-Stage As for the API release environment, only the API released in the current environment can be called. The current values include release, pre-online, test, and the value is release by default in case of not passing.
          Host default.gateway.com
          ContentType application/json

          2.Signature Verification

          Signature Verification Process

          Error Code List

          No. Error code Error message Description HTTP status code
          1 EmptySignature Signature is empty The signature is empty. 400
          2 SignatureFormatInvalid Signature is invalid: invalid signature format. The signature format is wrong. 400
          3 SignatureAppInvalid Signature is invalid: app key is invalid. The APP key doesn't exist. 400
          4 RequestTimeTooSkewed The difference between the request time and the server's time is too large. There is a great difference between the client-side time and server time. 403
          5 SignatureTimestampInvalid Signature is invalid: timestamp is expired. The signature expires. 400
          6 SignatureTimestampExpired Signature is invalid: signature is mismatched. The signature values don’t match. 400
          7 SignatureMismatch Signature is invalid: timestamp is invalid. Time stamp 400

          Example of APP Signature Request

          1.Common APP authentication.

          POST /app/1 HTTP/1.1 
          X-Bce-Signature: bce-auth-v1/359117df989c4a3db52289bbb8d286fb/2018-12-06T03:05:00Z/1800/content-type;host/4f2408c97f217f1a28b3771c816843656ede2e968ac1f912711560da7f31dafd
          Host: default1.gateway-mock.com 
          Content-Type: application/json
          
          {} 

          2.APP authentication in the cloud market.

          POST /app/1 HTTP/1.1 
          X-Bce-Signature: AppCode/9ae2bf211459430e9cee594ff1d2a325
          // is followed by the specific appCode. 
          Host: default1.gateway-mock.com 
          Content-Type: application/json
          
          {}
          Previous
          Step 2 Acquire API Authorization
          Next
          APP Authentication Signature String Generation