Link

Metering and Access



GET Access endpoint

Used to get access details for a reader for a given story.

Arguments
story-id required
The unique identifier of the story which user is trying to read.
key required
The account key
readerId required
Unique identifier of a reader genereated by client. It could be readers's device Id, or browser finger print or any other alphanumeric string to uniquely identify the reader.
accesstype_jwt optional
Used for logged in meter when the reader is logged in. This is the authorized user jwt
disable-meter optional
Needs to be sent as true for stories behind hard paywall. Such stories will not be metered and access will be granted only to subscribers.</a>
  $ curl -H 'X-SUBAUTH: <api-auth-key>'\
  -X GET 'https://accesstype.com/api/access/v1/stories/<story-id>/access?readerId=<readerId>&key=<key>&accesstype_jwt=<accesstype_jwt>'
Returns

This returns an access grant object if the call succeeded.


POST Pingback endpoint

Used to update meter of a reader when he has read a story which was granted access due to meter. Call this API immediately if the response from GET access API has granted: true and grantReason: METERING.

Arguments
story-id required
The unique identifier of the story which user is trying to read.
key required
The account key
readerId required
Unique identifier of a reader genereated by client. It could be readers's device Id, or browser finger print or any other alphanumeric string to uniquely identify the reader.
accesstype_jwt optional
Used for logged in meter when the reader is logged in. This is the authorized user jwt
disable-meter optional
Needs to be sent as true for stories behind hard paywall. Such stories will not be metered and access will be granted only to subscribers.</a>

The request body is required to be same as access grant object returned from access API.

  $ curl -H "Content-Type: text/plain" \
  -H 'X-SUBAUTH: <api-auth-key>' \
  -X POST 'https://accesstype.com/api/access/v1/stories/<story-id>/pingback?readerId=<readerId>&key=<key>&accesstype_jwt=<accesstype_jwt> -d {
  "granted": true,
  "grantReason": "METERING",
  "data": {
    "numberRemaining": 6,
    "isLoggedIn": true
  }
}'
Returns

This returns an empty object if the call succeeded.