This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Hooks in CodePlex



Overview

The following operations allow you to work with Hooks in CodePlex. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with Users, see Sample configuration.

OperationDescription
getSupportedHooksProvides supported hooks for a specified codeplex project.
getHookSubscriptionsProvides subscription list for a specified codeplex project and hook.
getSubscriptionProvide subscription details of specified subscription id, hook and project.
createSubscriptionCreate a subscription on a specified hook and project.
updateSubscriptionUpdate specified subscription.
deleteSubscriptionDelete specified subscription.

Operation details

This section provides the details on each operation related to Hooks in CodePlex.

Get the list of supported service hooks

getSupportedHooks
<codeplex.getSupportedHooks>
    <project>geospatial</project>
</codeplex.getSupportedHooks>
Properties
  • clientId           : Client Id of the CodePlex app.
  • clientSecret   : Client secret of the CodePlex.
  • refreshToken : Refresh token acquired from codeplex OAuth.
  • project           :The name of the project to retrieve its supported hooks.
Sample request

Following is a sample REST/JSON request that can be handled by the getSupportedHooks operation.

Sample Request for getSupportedHooks
{
"clientId":"e2ca3fc77e334c679f0c5c50257f9f37",
"clientSecret":"44c635345fbd408d96e675b0aaf13343",
"refreshToken":"L4Eo!IAAAAL3yP6zFRfsriup7jYcQThecBNIpHJ4UJFfYfGKDP2MNsQAAAAHxh0bbfEjjP7RDQBsRrELlW6cZDe4sGcT5jp3jNGxSkmwUZya3qDhgcPVxOyIuj-SC0fhdc5LP8xIqOWqR1SjiDa9d29uvopFxv-da14X2i_QByD1XCKPUHie04VKVphk_q0ta9AjsXc9MrUR9a6O24U_Da9srHendD0TJJKfygjHgYvFzkO3KIcoHmG2abPHybkBOBQHyltaHJwfESYohqHqRhL_FwJfnSRJjrzq8dl",
"project":"geospatial"
}

Get the list of subscriptions for a service hook

getHookSubscriptions
<codeplex.getHookSubscriptions>
    <project>geospatial</project>
    <hookId>8</hookId>
</codeplex.getHookSubscriptions>
Properties
  • clientId           : Client Id of the CodePlex app.
  • clientSecret   : Client secret of the CodePlex.
  • refreshToken : Refresh token acquired from codeplex OAuth.
  • project           : The name of the project.
  • hookId           : The Identification of the hook.

Sample request

Following is a sample REST/JSON request that can be handled by the getHookSubscriptions operation.

Sample Request for getHookSubscriptions
{
"clientId":"e2ca3fc77e334c679f0c5c50257f9f37",
"clientSecret":"44c635345fbd408d96e675b0aaf13343",
"refreshToken":"L4Eo!IAAAAL3yP6zFRfsriup7jYcQThecBNIpHJ4UJFfYfGKDP2MNsQAAAAHxh0bbfEjjP7RDQBsRrELlW6cZDe4sGcT5jp3jNGxSkmwUZya3qDhgcPVxOyIuj-SC0fhdc5LP8xIqOWqR1SjiDa9d29uvopFxv-da14X2i_QByD1XCKPUHie04VKVphk_q0ta9AjsXc9MrUR9a6O24U_Da9srHendD0TJJKfygjHgYvFzkO3KIcoHmG2abPHybkBOBQHyltaHJwfESYohqHqRhL_FwJfnSRJjrzq8dl",
"project":"geospatial",
"hookId":"8"
}

Get subscription

getSubscription
<codeplex.getSubscription>
    <project>geospatial</project>
    <hookId>4</hookId>
    <subscriptionId>3735</subscriptionId>
</codeplex.getSubscription>
Properties
  • clientId             : Client Id of the CodePlex app.
  • clientSecret     : Client secret of the CodePlex.
  • refreshToken   : Refresh token acquired from codeplex OAuth.
  • project             :The name of the project.
  • hookId             : The Identification of the hook.

  • subscriptionId : The Identification of the subscription.

Sample request

Following is a sample REST/JSON request that can be handled by the getSubscription operation.

Sample Request for getSubscription
{
"clientId":"e2ca3fc77e334c679f0c5c50257f9f37",
"clientSecret":"44c635345fbd408d96e675b0aaf13343",
"refreshToken":"L4Eo!IAAAAL3yP6zFRfsriup7jYcQThecBNIpHJ4UJFfYfGKDP2MNsQAAAAHxh0bbfEjjP7RDQBsRrELlW6cZDe4sGcT5jp3jNGxSkmwUZya3qDhgcPVxOyIuj-SC0fhdc5LP8xIqOWqR1SjiDa9d29uvopFxv-da14X2i_QByD1XCKPUHie04VKVphk_q0ta9AjsXc9MrUR9a6O24U_Da9srHendD0TJJKfygjHgYvFzkO3KIcoHmG2abPHybkBOBQHyltaHJwfESYohqHqRhL_FwJfnSRJjrzq8dl",
"subscriptionId":"3735",
"project":"geospatial",
"hookId":"4"
}

Create subscription

createSubscription
<codeplex.createSubscription>
    <project>geospatial</project>
    <hookId>4</hookId>
    <eventName>Code Change</eventName>
    <eventEnabled>true</eventEnabled>
    <eventProperties>[{'Name':'url','Value':'val'}]</eventProperties>
    <subscriptionProperties></subscriptionProperties>
</codeplex.createSubscription>
Properties
  • clientId                        : Client Id of the CodePlex app.
  • clientSecret                 : Client secret of the CodePlex.
  • refreshToken               : Refresh token acquired from codeplex OAuth.
  • project                         : The name of the project.
  • hookId                         : The Identification of the hook.

  • eventName                  : Subscribing event name.

  • eventEnabled              : Event enabled or Disabled.

  • eventProperties           : Properties of event.

  • subscriptionProperties : Properties of subscription.

Sample request

Following is a sample REST/JSON request that can be handled by the createSubscription operation.

Sample Request for createSubscription
{
"clientId":"e2ca3fc77e334c679f0c5c50257f9f37",
"clientSecret":"44c635345fbd408d96e675b0aaf13343",
"refreshToken":"L4Eo!IAAAAL3yP6zFRfsriup7jYcQThecBNIpHJ4UJFfYfGKDP2MNsQAAAAHxh0bbfEjjP7RDQBsRrELlW6cZDe4sGcT5jp3jNGxSkmwUZya3qDhgcPVxOyIuj-SC0fhdc5LP8xIqOWqR1SjiDa9d29uvopFxv-da14X2i_QByD1XCKPUHie04VKVphk_q0ta9AjsXc9MrUR9a6O24U_Da9srHendD0TJJKfygjHgYvFzkO3KIcoHmG2abPHybkBOBQHyltaHJwfESYohqHqRhL_FwJfnSRJjrzq8dl",
"project":"geospatial",
"hookId":"4",
"eventName":"Code Change",
"eventEnabled":"true",
"eventProperties":"[{'Name':'url','Value':'val'}]",
"subscriptionProperties":""
}

Update subscription

updateSubscription
<codeplex.updateSubscription>
    <subscriptionId>3989</subscriptionId>
    <project>geospatial</project>
    <hookId>8</hookId>
    <eventName>Code Change</eventName>
    <eventEnabled>true</eventEnabled>
    <eventProperties></eventProperties>
    <subscriptionProperties></subscriptionProperties>
</codeplex.updateSubscription>
Properties
  • clientId                        : Client Id of the CodePlex app.
  • clientSecret                 : Client secret of the CodePlex.
  • refreshToken               : Refresh token acquired from codeplex OAuth.
  • project                         : The name of the project.
  • hookId                         : The Identification of the hook.
  • eventName                  : Subscribing event name.
  • eventEnabled              : Event enabled or Disabled.
  • eventProperties           : Properties of event.
  • subscriptionProperties : Properties of subscription.
  • subscriptionId               : The Identification of the subscription.

Sample request

Following is a sample REST/JSON request that can be handled by the updateSubscription operation.

Sample Request for updateSubscription
{
"clientId":"e2ca3fc77e334c679f0c5c50257f9f37",
"clientSecret":"44c635345fbd408d96e675b0aaf13343",
"refreshToken":"L4Eo!IAAAAL3yP6zFRfsriup7jYcQThecBNIpHJ4UJFfYfGKDP2MNsQAAAAHxh0bbfEjjP7RDQBsRrELlW6cZDe4sGcT5jp3jNGxSkmwUZya3qDhgcPVxOyIuj-SC0fhdc5LP8xIqOWqR1SjiDa9d29uvopFxv-da14X2i_QByD1XCKPUHie04VKVphk_q0ta9AjsXc9MrUR9a6O24U_Da9srHendD0TJJKfygjHgYvFzkO3KIcoHmG2abPHybkBOBQHyltaHJwfESYohqHqRhL_FwJfnSRJjrzq8dl",
"subscriptionId":"3989",
"project":"geospatial",
"hookId":"8",
"eventName":"Code Change",
"eventEnabled":"true",
"eventProperties":"",
"subscriptionProperties":""
}

Delete a subscription

deleteSubscription
<codeplex.deleteSubscription>
    <project>geospatial</project>
    <hookId>8</hookId>
    <subscriptionId>3989</subscriptionId>
</codeplex.deleteSubscription>
Properties
  • clientId           : Client Id of the CodePlex app.
  • clientSecret    : Client secret of the CodePlex.
  • refreshToken  : Refresh token acquired from codeplex OAuth.
  • project            :The name of the project.
  • hookId            : The Identification of the hook.

  • subscriptionId : The Identification of the subscription.

Sample request

Following is a sample REST/JSON request that can be handled by the deleteSubscription operation.

Sample Request for deleteSubscription
{
"clientId":"e2ca3fc77e334c679f0c5c50257f9f37",
"clientSecret":"44c635345fbd408d96e675b0aaf13343",
"refreshToken":"L4Eo!IAAAAL3yP6zFRfsriup7jYcQThecBNIpHJ4UJFfYfGKDP2MNsQAAAAHxh0bbfEjjP7RDQBsRrELlW6cZDe4sGcT5jp3jNGxSkmwUZya3qDhgcPVxOyIuj-SC0fhdc5LP8xIqOWqR1SjiDa9d29uvopFxv-da14X2i_QByD1XCKPUHie04VKVphk_q0ta9AjsXc9MrUR9a6O24U_Da9srHendD0TJJKfygjHgYvFzkO3KIcoHmG2abPHybkBOBQHyltaHJwfESYohqHqRhL_FwJfnSRJjrzq8dl",
"subscriptionId":"3989",
"project":"geospatial",
"hookId":"8"
}

Sample configuration

Following is a sample proxy service that illustrates how to connect to CodePlex with getAccessToken operation to use the getSupportedHooks operation. The sample request for this proxy can be found in getSupportedHooks sample request.

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="codeplexGetSupportedHooksProxy"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
    <target>
        <inSequence>
            <property name="clientId" expression="json-eval($.clientId)"/>
            <property name="clientSecret" expression="json-eval($.clientSecret)"/>
            <property name="refreshToken" expression="json-eval($.refreshToken)"/>
            <property name="project" expression="json-eval($.project)"/>
            <codeplex.getAccessToken>
                <clientId>{$ctx:clientId}</clientId>
                <clientSecret>{$ctx:clientSecret}</clientSecret>
                <refreshToken>{$ctx:refreshToken}</refreshToken>
            </codeplex.getAccessToken>
            <codeplex.getSupportedHooks>
                <project>{$ctx:project}</project>
            </codeplex.getSupportedHooks>
            <respond/>
        </inSequence>
        <outSequence>
            <send/>
        </outSequence>
    </target>
    <description/>
</proxy>