GET /api/apis/versions/{APIVersionID}/contracts

Returns information about contracts for the specified API version, in the form of a JSON object.

Authorization Roles/Permissions: Must be logged in. Must have read permission for the resource.

This topic includes the following sections:

HTTP Method

GET

URL

https://{hostname}/api/apis/versions/{APIVersionID}/contracts[?][ActivatedOnly={Boolean}]&[Environment={Environment}]

Sample Request

The example below shows a request for the contracts for the specified API version.

Request URL #1

Returns results for all environments.

https://{hostname}/api/apis/versions/9c84bae7-e5fa-49aa-b90f-ae1b4de79861.acmepaymentscorp/contracts

Request URL #2

With optional parameter, returns only contracts with a state of Activated.

https://{hostname}/api/apis/versions/9c84bae7-e5fa-49aa-b90f-ae1b4de79861.acmepaymentscorp/contracts?ActivatedOnly=true

Sample request headers

Accept: application/vnd.soa.v72+json
Cookie: {cookie}

Sample request body

Not applicable.

Request Headers

For general information on request header values, refer to HTTP Request Headers.

Header Description
Accept

application/vnd.soa.v72+json, application/vnd.soa.v72+xml

application/vnd.soa.v80+json, application/vnd.soa.v80+xml

application/vnd.soa.v81+json, application/vnd.soa.v81+xml

Cookie AtmoAuthToken_{fedmemberid}={cookie value, which usually starts with TokenID}—The platform cookie. This is the Akana API Platform authorization token, and must be sent with every API request that requires login. For more information and an example, see Session cookies.
X-Csrf-Token_{fedmemberID} The CSRF prevention header; may or may not be required, depending on platform settings. See CSRF Prevention on the Platform. By default, the CSRF header is not required for GET operations and is required for all others, with a few exceptions relating to user login.

Request Parameters

Parameter Parm Type Data Type Required Description
APIVersionID Path string Required The unique ID for a specific API version.
ActivatedOnly Query boolean Optional If set to true, only activated contracts are returned. If set to false or not specified, all contracts are returned.
Environment Query string Required The environment (implementation) (Sandbox or Production). If specified, returns only contracts for that environment. If not specified, all are returned.

Response

If successful, this operation returns HTTP status code 200, with information about the contracts for the specified API version.

Sample Response

The sample response below shows successful completion of this operation (request URL #1). Since a request parameter was included, only contracts with a state of Activated are returned. There is one contract in the results.

Sample response headers: application/vnd.soa.v72+json

Status Code: 200 OK
Content-Type: application/vnd.soa.v72+json
Date: Tue, Tue, 31 Mar 2015 13:14:40 GMT

Sample response body: application/vnd.soa.v72+json

{
  "Contract" : [ {
    "ContractID" : "f75b127c-330a-4918-8eb5-8843a5afbd5f.acmepaymentscorp",
    "APIVersionID" : "9c84bae7-e5fa-49aa-b90f-ae1b4de79861.acmepaymentscorp",
    "RuntimeID" : "4eiyAsyzENo1nVPZBEZgHM4E.acmepaymentscorp",
    "Environment" : "Sandbox",
    "State" : "apicontract.status.activated",
    "ContractScope" : {
      "Restricted" : true,
      "LicenseID" : [ "d071d7f3-c190-4085-9bb7-e4d11d87bc6d.acmepaymentscorp", "1cd6310d-5781-421f-b9a8-20fbc7a12926.acmepaymentscorp" ]
    },
    "Updated" : "2015-03-31T18:53:52Z",
    "UpdatedInMillis" : 1427828032000,
    "TargetResources" : {
      "TargetResource" : [ {
        "Name" : "1.0",
        "ID" : "9c84bae7-e5fa-49aa-b90f-ae1b4de79861.acmepaymentscorp",
        "Type" : "apiversion",
        "Visibility" : "Limited",
        "IsResourceLevelPermissionSupported" : true
      }, {
        "Name" : "ACME Payments API",
        "ID" : "6389403c-18a5-4550-966e-3ed8a0f0ba54.acmepaymentscorp",
        "Type" : "api",
        "Image" : {
          "Url" : "http://{hostname}/api/apis/6389403c-18a5-4550-966e-3ed8a0f0ba54.acmepaymentscorp/avatar",
          "Title" : "api",
          "Link" : "#/api/6389403c-18a5-4550-966e-3ed8a0f0ba54.acmepaymentscorp/versions/9c84bae7-e5fa-49aa-b90f-ae1b4de79861.acmepaymentscorp/details"
        }
      }, {
        "Name" : "1.0",
        "ID" : "4eiyAsyzENo1nVPZBEZgHM4E.acmepaymentscorp",
        "Type" : "app-version"
      }, {
        "Name" : "crosfhocal",
        "ID" : "80168eb0-5593-4e0f-a708-7cc9a6bd3cfc.acmepaymentscorp",
        "Type" : "app",
        "Image" : {
          "Url" : "http://{hostname}/api/apps/80168eb0-5593-4e0f-a708-7cc9a6bd3cfc.acmepaymentscorp/avatar",
          "Title" : "app",
          "Link" : "#/app/80168eb0-5593-4e0f-a708-7cc9a6bd3cfc.acmepaymentscorp/versions/4eiyAsyzENo1nVPZBEZgHM4E.acmepaymentscorp/details"
        }
      }, {
        "ID" : "contract_request11793.acmepaymentscorp",
        "Type" : "board-item"
      }, {
        "Name" : "Bronze",
        "ID" : "d071d7f3-c190-4085-9bb7-e4d11d87bc6d.acmepaymentscorp",
        "Type" : "license"
      }, {
        "Name" : "Gold",
        "ID" : "1cd6310d-5781-421f-b9a8-20fbc7a12926.acmepaymentscorp",
        "Type" : "license"
      } ]
    },
    "Status" : "com.soa.apicontract.inforce"
  } ]
}

Response Headers

For general information on response header values, refer to HTTP Response Headers.

Header Description
Content-Type

application/vnd.soa.v72+json, application/vnd.soa.v72+xml

application/vnd.soa.v80+json, application/vnd.soa.v80+xml

application/vnd.soa.v81+json, application/vnd.soa.v81+xml

Response Body

Name Type Description
Contracts Contracts Includes information about one or more app/API contracts.

Error Codes/Messages

If the call is unsuccessful an error code/message is returned. One or more examples of possible errors for this operation are shown below.

Item Value
401 Unauthorized. For example, you would get this response if you didn't include the custom X-Csrf-Token_{fedmemberID} header in the request, when it was required by the platform settings; or if you included an invalid or expired value for this header. You would also get this response for any operation that requires login (almost all) if the login cookie was missing. You would also get it if you are not an authorized viewer of the API.
404 The resource could not be found. For example, you might get this if you have a typo in the URL, or if the Accept header is set to a wrong value.
500 An error occurred processing the call.

More information about Akana API Platform API error messages.