Application Service

Overview

The application service provides calls to create and maintain your applications in the Pinch Media system.

Methods


addApplication(application)

Overview

This method is used to add an application associated with the current API key.

Parameters

application (string) - A json representation of an application, for example:

"application":{
  "name":"this is the application name",
  "type_id":"1",
  "description":"this is the application description",
  "is_free":"0",
  "cost":"1.99",
  "currency_id":"1",
  "company":"company name here",
  "website":"http:\/\/www.website.com"
}

Required

name (string)
is_free (integer) - Boolean (0 or 1)
type_id (integer) - The overall subject matter of the application.

1 - Business
2 - Communication
3 - Entertainment
4 - Finance
5 - Games
6 - Health & Fitness
7 - Lifestyle
8 - Music
9 - Navigation
10 - News
11 - Photography
12 - Productivity
13 - Reference
14 - Shopping
15 - Social Networking
16 - Sports
17 - Travel
18 - Utilities
19 - Weather
20 - Other



Optional

cost (float) - The cost of the application, for example "1.99".
company (string) - The name of the company that created or owns the application.
description (string) - A short description of the application's functionality.
website (string) - A url when more information about the application can be found.
currency (integer) - The currency used by the Pinch Sales Estimator in reporting.

1 - USD ($)
2 - CAD ($)
3 - AUD ($)
4 - JPY (¥)
5 - Euros (€)
6 - GBP (£)

 

Response

Success or the reason for the call's failure.

Example Responses

Success

{
  "response":"success",
  "data":{
    "application":{
      "name":"Application name",
      "code":"209f3f6669ae346fc2115a37a6f7241d",
      "category":"Business",
      "description":"Application description",
      "is_free":"1",
      "company":"Pinch Media",
      "website":"http:\/\/www.pinchmedia.com",
      "languages":[]
    }
  }
}

Failure

{
  "response":"error",
  "data":{
    "error":"Invalid parameter -- invalid application name supplied"
  }
}



Please note, after adding a new application the addIgnoredDevices, addTags, and addLanguages methods can be called to add those properties to the application object.

addIgnoredDevice(applicationCode, deviceId)

Overview

This method adds a device that will be ignored by Pinch Analytics' recording and reporting.

Parameters

applicationCode (string) - The application code.
deviceId (string) - The id of the device for which Pinch Analytics should not record or report beacons.

Response

Success or the reason for the call's failure.

Example Responses

Success

{
"response":"success",
"data":{
"success"
}
}

Failure

{
  "response":"error",
  "data":{
    "error":"Invalid parameter -- invalid device id supplied"
  }
}

 

addLanguage(applicationCode, language)

Overview

This method adds a language to the application.

Parameters

applicationCode (string) - The application code.
language (int) - The id of the language. To get a list of languages use retrieveLanguages.

Response

{
  "response":"success",
  "data":{
    "languages":{
      "1":"English",<
      "2":"French",
      "3":"German",
      "4":"Italian",
      "5":"Japanese",
      "6":"Spanish"
    }
  }
}

 

addTag(applicationCode, tag)

Overview

This method associates a descriptive tag with an application. Tags cannot be more than 100 characters.

Parameters

applicationCode (string)
tag (string) - The tag that should be associated with an application.

Response

Success or the reason for the call's failure.

Example Responses

Success

{
"response":"success",
"data":{
"success"
}
}

Failure

{
"response":"error",
"data":{
"error":"Invalid parameter -- Invalid tag supplied
"
}
}

 

addUserWithUsername(applicationCode, username, isAdmin)

Overview

This method adds a pre-existing Pinch Media developer account holder to an application, allowing that user to access the analytics for that application, including acting as an administraitor for that application.

Parameters

applicationCode (string)
username (string) - The username of the person to be added to the application.
isAdmin (boolean) - Whether or not the newly added user should have administrator privileges.

Response

Success or the reason for the call's failure.

Example Responses

Success

{
"response":"success",
"data":{
"success"
}
}

Failure

{
"response":"error",
"data":{
"error":"Invalid parameter -- Invalid username supplied
"
}
}

addUserWithEmail(applicationCode, email, isAdmin, invite)

Overview

This method adds a pre-existing account holder to an application. In addition a person without a Pinch Media developer account can be invited to create one, at which time they that user will be able to access the application's analytics.

Parameters

applicationCode (string)
email (string) - The email of the person to be added to the application.
isAdmin (boolean) - Whether or not the newly added user should have administraitor privileges.
invite (boolean) - Whether or not an invitation to create a Pinch Media developer account should be sent to the supplied email address.

Response

Success or the reason for the call's failure.

Example Responses

Success

{
"response":"success",
"data":{
"success"
}
}

Failure

{
"response":"error",
"data":{
"error":"Invalid parameter -- Invalid email address supplied
"
}
}

 

removeIgnoredDevice(applicationCode, deviceId)

Overview

This method removes a device from the list of devices that are ignored by Pinch Media's analytics recording and reporting.

Parameters

applicationCode (string)
deviceId (string) - The device id to be removed.

Response

Success or the reason for the call's failure.

Example Responses

Success

{
"response":"success",
"data":{
"success"
}
}

Failure

{
"response":"error",
"data":{
"error":"Invalid parameter -- Invalid device id supplied
"
}
}

 

removeLanguage(applicationCode, language)

Overview

This method removes a language from the application.

Parameters

applicationCode (string)
language (int) - The id of the language to remove.

Response

Success or the reason for the call's failure.

Example Responses

Success

{
"response":"success",
"data":{
"success"
}
}

Failure

{
"response":"error",
"data":{
"error":"Invalid parameter -- Invalid language supplied
"
}
}

removeTag(applicationCode, tag)

Overview

This method removes a tag associated with an application.

Parameters

applicationCode (string)
tag (string) - The tag to remove from the associated application.

Response

Success or the reason for the call's failure.

Example Responses

Success

{
"response":"success",
"data":{
"success"
}
}

Failure

{
"response":"error",
"data":{
"error":"Invalid parameter -- Invalid tag supplied
"
}
}

retrieveApplication(applicationCode)

Overview

This method is used to retrieve one application associated with the current API key.

Parameters

applicationCode (string) - The application code for an application associated with the current developer

Response

One application will be returned.

Example Response

{
  "response":"success",
  "data":{
    "application":{
      "name":"Application 1",
      "code":"1234567890abcdef1234567890abcdef",
      "category":"Entertainment",
      "description":"This is a sample application",
      "is_free":"0",
      "cost":"$0.99",
      "company":"Pinch Media",
      "website":"http:\/\/www.pinchmedia.com\/",
      "languages":["English","Japanese"]
    }
  }
}

 

retrieveApplications()

Overview

This method is used to retrieve all applications associated with the current API key.

Parameters

none

Response

An array of applications will be returned.

Example Response

{
"response":"success",
"data":{
"applications":[
{"code":"1234567890abcdef1234567890abcdef","name":"Application 1","is_admin":"1"},
{"code":"fedcba0987654321fedcba0987654321","name":"Application 2","is_admin":"0"}
]
}
}


retrieveCurrencies()

Overview

This method retrieves the currency symbol and id of all currencies supported by Pinch Media.

Parameters

None

Response

An array of currencies and their ids.

Example Response

Success


{
   "response":"success",
      "data":{
             "currencies":{
                          "1":"$",
                          "2":"$",
                          "3":"$",
                          "4":"¥",
                          "5":"€",
                          "6":"£"
                          }
             }
}

 

retrieveIgnoredDevices(applicationCode)

Overview

This method is used to retrieve all devices that should be ignored by Pinch Media's analytics' recording and reporting associated with an application.

Parameters

applicationCode (string)

Response

An array of devices.

Example Response

Success

{
"response":"success",
"data":{
"ignored_devices":["123","456"]
}
}

Failure

{
"response":"error",
"data":{
"error":"Invalid parameter -- Invalid application code supplied
"
}
}

 

retrieveLanguages()

Overview

This method retrieves an array of all languages which can be associated with an application.

Parameters

none

Response

An array of languages.

Example Response

Success

{
  "response":"success",
  "data":{
    "languages {
      "1":"English",
      "2":"French",
      "3":"German",
      "4":"Italian",
      "5":"Japanese",
      "6":"Spanish"
    }
  }
}

 

retrieveTags

Overview

This method retrieves all tags associated with an application.

Parameters

applicationCode (string)

Response

An array of users.

Example Response

Success

{
  "response":"success",
  "data":{
         "tags":[
                "big","brown","bear","bicycling","backwards"
                ]
         }
}

Failure

{
"response":"error",
"data":{
"error":"Invalid parameter -- Invalid application code supplied
"
}
}

 

retrieveTypes

Overview

This method retrieves all application types.

Parameters

None

Response

An array of application types.

Example Response

Success

{
   "response":"success",
   "data":{
          "application_types":{
                              "1":"Business",
                              "2":"Communication",
                              "3":"Entertainment",
                              "4":"Finance",
                              "5":"Games",
                              "6":"Health & Fitness",
                              "7":"Lifestyle",
                              "8":"Music",
                              "9":"Navigation",
                              "10":"News",
                              "11":"Photography",
                              "12":"Productivity",
                              "13":"Reference",
                              "14":"Shopping",
                              "15":"Social Networking",
                              "16":"Sports",
                              "17":"Travel",
                              "18":"Utilities",
                              "19":"Weather",
                              "20":"Other"
                              }
          }
}

retrieveUsers(applicationCode)

Overview

This method retrieves all users associated with an application.

Parameters

applicationCode (string)

Response

An array of users.

Example Response

Success

{
  "response":"success",
  "data":{
    "users":[
      {"first_name":"John","last_name":"Doe","company":"Pinch Media","last_login":"2008-05-26 10:59:46","is_admin":"1"},
      {"first_name":"Jane ","last_name":"Doe","company":"Pinch Media","last_login":"2008-05-26 18:31:04","is_admin":"1"}
    ]
  }
}

Failure

{
"response":"error",
"data":{
"error":"Invalid parameter -- Invalid application code supplied
"
}
}

 

updateApplication(applicationCode, application)

Overview

This method updates an application.

Parameters

applicationCode (string) - The application code of the application to be updated.
application (string) - A json representation of the application, for example:

"application":{
  "name":"this is the application name",
  "type_id":"1",
  "description":"this is the application description",
  "is_free":"0",
  "cost":"1.99",
  "currency_id":"1",
  "company":"company name here",
  "website":"http:\/\/www.website.com"
}

Response

Success or the reason for the call's failure.

Example Response

Success

{
"response":"success",
"data":{
"success"
}
}

Failure

{
"response":"error",
"data":{
"error":"There was nothing new to update"

}
}