Link Poken to Account

Description

Each account in the Poken System may have one or more poken devices associated with it. This method allows to link a device to the users account. This endpoint should be access only by passing one of the 3 parameters: deviceAccessToken, contactstring or deviceId To obtain a deviceAccessToken call the method "Upload Contact String" passing the HTML file on the Poken device as parameter. The method returns a Device Access Token which can be used in this method to link the device to the user account. If the 'deviceId' parameter is provided, make sure the device is part of the same poken campaign as the account making the request

HTTP Method

POST

Path

/devices

Authentication

Does not require user authentication.

Parameters

Table 24.  Parameters for " Link Poken to Account "

NameTypeValue TypeDescription
deviceAccessTokenFORMString(optional) The accessToken of the poken device to link to the users account.
objectIdFORMlong(optional) id of the object/identity to be linked to this device. If not provided the account's default object will be used.
contactstringFORMString(optional) Token or url of this device, example 2011abcdef1234567890bedd2fdd4150.
deviceIdFORMlong(optional) id of the device to be linked to the account making the request
forAccountIdFORMlong(optional) this parameter can be provided only if used with 'deviceId' parameter. Allows linking a campaign device to an account making an unauthenticated call. Will only succeed if the 'forAccountId' is part of one campaign of the API client making the request.
forCampaignIdFORMlong(optional) this parameter can be provided only if used with 'forAccountId' and if the user making the request is an owner of the provided campaign. Allows linking the device to the campaign, in case it was not already linked, and to the provided 'accountId'.

Error Codes

10019 ( Account )

The account specified is invalid.

10033 ( Account )

This endpoint is supported just for OAuth2 requests.

130005 ( Object )

The user does not have access to update this object.

130006 ( Object )

The oject Id specified does not exist.

20000 ( Device )

An unhandled exception has occured.

20001 ( Device )

Not a valid deviceAccessToken provided!

20002 ( Device )

Unabled to update the device detail information.

20006 ( Device )

The provided device is not linked to a campaign.

20007 ( Device )

Device linked to a different campaign then the account making the request.

20008 ( Device )

Device linked to a campaign that is no longer available.

20009 ( Device )

Unable to link account to the device!

20010 ( Device )

No parameter provided for linking a device to an account!

20011 ( Device )

Tag URI/URL failed validation!

20012 ( Device )

This device is already linked to an account!

20014 ( Device )

The client making the request doesn't have a common campaign with the account to link the device to

20015 ( Device )

The provided device is not valid

20018 ( Device )

Can not link the device to the object's campaign. The campaign already has the number of maximum demo devices linked to it

Response Schema

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema elementFormDefault="qualified" version="1.0" targetNamespace="http://xsd.poken.com" xmlns:tns="http://xsd.poken.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="response">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="success" type="tns:Status" default="FAILURE" minOccurs="0"/>
        <xs:element name="error" type="tns:Error" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:complexType name="Error">
    <xs:sequence>
      <xs:element name="code" type="xs:string"/>
      <xs:element name="description" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

  <xs:simpleType name="Status">
    <xs:restriction base="xs:string">
      <xs:enumeration value="SUCCESS"/>
      <xs:enumeration value="FAILURE"/>
    </xs:restriction>
  </xs:simpleType>
</xs:schema>

Sample Response

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response xmlns="http://xsd.poken.com">
	<success>SUCCESS</success>
</response>