PUT /api/apis/versions/{APIVersionID}/viewers/{ViewerID}

Saves private viewer scope for an API.

Authorization Roles/Permissions: Must have Modify permission for the resource.

Metadata indexing: When this operation is run successfully, the platform metadata is automatically reindexed. Since the API documentation might include a metadata.xml file that directs visibility, the index must be updated when the API documentation resources are updated, to ensure the correct API documentation visibility settings are implemented.

This topic includes the following sections:

HTTP Method

PUT

Back to top

URL

https://{hostname}/api/apis/versions/{APIVersionID}/viewers/{ViewerID}

Back to top

Sample Request

The example below shows a request for the specified group to have visibility of the specified API version.

Request URL

https://{hostname}/api/apis/versions/a1fa6440-8fa6-4453-a0a0-4db181ab1512.acmepaymentscorp/viewers/d7244dd9-5f36-4d3d-979c-5558d50c8ecf.acmepaymentscorp

Sample request headers

PUT /api/apis/versions/a1fa6440-8fa6-4453-a0a0-4db181ab1512.acmepaymentscorp/viewers/d7244dd9-5f36-4d3d-979c-5558d50c8ecf.acmepaymentscorp HTTP/1.1
Accept: application/json, text/javascript, */*; q=0.01
Content-Type: application/json; charset=UTF-8
X-Csrf-Token_{tenant}: {TokenID}

Sample request body

{
  "ResourceID":"a1fa6440-8fa6-4453-a0a0-4db181ab1512.acmepaymentscorp",
  "ViewerID":"d7244dd9-5f36-4d3d-979c-5558d50c8ecf.acmepaymentscorp",
  "ViewerType":"group",
  "RestrictedScope":"true",
  "LicenseID":[
    "45caa075-8d75-4497-b528-dc2a7e2d72b6.acmepaymentscorp"
  ]
}

Back to top

Request Headers

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

Header Description
Accept

application/json, application/xml

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

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

Content-Type

Any one of the following media types is valid for the request Content-Type:

application/json or application/xml

application/vnd.soa.v71+json or application/vnd.soa.v71+xml

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

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

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

X-Csrf-Token_{fedmemberID} The CSRF prevention header; may or may not be required, depending on platform settings. See CSRF Prevention on the Platform.

Back to top

Request Parameters

Parameter Parm Type Data Type Required Description
APIVersionID Path string Required The unique ID for a specific API version.
ViewerID Path string Required The User ID of the viewer.
VisibilityScope Body VisibilityContract Required Contains information about a visibility contract between a resource and a viewer.

Back to top

Response

If successful, this operation returns HTTP status code 200, with information about the updated private viewer scope.

Back to top

Sample Response

The sample response below shows successful completion of this operation.

Sample response headers: application/json

HTTP/1.1 200 OK
Content-Type: application/json
Expires: Tue, 10 Jun 2014 12:44:43 GMT

Sample response body: application/json

{
  "ResourceID" : "a1fa6440-8fa6-4453-a0a0-4db181ab1512.acmepaymentscorp",
  "ResourceType" : "apiversion",
  "ViewerID" : "d7244dd9-5f36-4d3d-979c-5558d50c8ecf.acmepaymentscorp",
  "ViewerType" : "group",
  "RestrictedScope" : true,
  "License" : [ {
    "LicenseID" : "45caa075-8d75-4497-b528-dc2a7e2d72b6.acmepaymentscorp",
    "Name" : "Bronze",
    "Description" : "Read-only access at no charge. Both environments, public, approval required.",
    "Visibility" : "Public",
    "SandboxAccessAutoApproved" : false,
    "ProductionAccessAutoApproved" : false,
    "LicenseParts" : {
      "LicensePart" : [ {
        "Name" : "cecec4c6-6c5d-46ec-8316-c885ce4e1b12",
        "ResourceID" : [ "d97e2638-75a9-42a3-98a6-99a4ad4940ce.acmepaymentscorp" ]
      } ]
    },
    "BusinessID" : "tenantbusiness.acmepaymentscorp"
  } ]
}

Back to top

Sample response headers: application/xml

Status Code: 200 OK
Content-Type: application/xml
Expires: Tue, 10 Jun 2014 14:49:58 GMT

Sample response body: application/xml

<?xml version="1.0" encoding="UTF-8"?>
<VisibilityContractDetails xmlns="http://soa.com/xsd/resource/1.0" xmlns:ns2="http://soa.com/xsd/business/1.0" 
xmlns:ns3="http://soa.com/xsd/legals/1.0" xmlns:ns4="http://soa.com/xsd/user/1.0">
  <ResourceID>a1fa6440-8fa6-4453-a0a0-4db181ab1512.acmepaymentscorp</ResourceID>
  <ResourceType>apiversion</ResourceType>
  <ViewerID>d7244dd9-5f36-4d3d-979c-5558d50c8ecf.acmepaymentscorp</ViewerID>
  <ViewerType>group</ViewerType>
  <RestrictedScope>true</RestrictedScope>
  <ns2:License>
    <ns2:LicenseID>45caa075-8d75-4497-b528-dc2a7e2d72b6.acmepaymentscorp</ns2:LicenseID>
    <ns2:Name>Bronze</ns2:Name>
    <ns2:Description>Read-only access at no charge. Both environments, public, approval required.</ns2:Description>
    <ns2:Visibility>Public</ns2:Visibility>
    <ns2:SandboxAccessAutoApproved>false</ns2:SandboxAccessAutoApproved>
    <ns2:ProductionAccessAutoApproved>false</ns2:ProductionAccessAutoApproved>
    <ns2:LicenseParts>
      <ns2:LicensePart>
        <ns2:Name>cecec4c6-6c5d-46ec-8316-c885ce4e1b12</ns2:Name>
        <ns2:ResourceID>d97e2638-75a9-42a3-98a6-99a4ad4940ce.acmepaymentscorp</ns2:ResourceID>
      </ns2:LicensePart>
    </ns2:LicenseParts>
    <ns2:BusinessID>tenantbusiness.acmepaymentscorp</ns2:BusinessID>
  </ns2:License>
</VisibilityContractDetails>

Back to top

Response Headers

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

Header Description
Content-Type

application/json, application/xml

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

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

Back to top

Response Body

Name Type Description
VisibilityContractDetails VisibilityContractDetails Contains information about a viewer's visibility of a specific resource.

Back to top

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.
500 An error occurred processing the call.

More information about Akana API Platform API error messages.

Back to top

Related Topics