Skip to content

Build the first application service

The first tool answers “How many vacation hours do I have left?”. Its API is a GET operation that returns the signed-in user’s absence balances. Building it proves every link in the chain: tokens, PeopleSoft security, the Application Services Framework (ASF), and the tool catalog.

Decision For this service
Service ZZ_ASSISTANT_HR, which will hold all of the Assistant’s HR tools
Resource The root resource absence, with the URI template balances, and a GET method
Input An optional plan, such as Vacation. No employee ID: the token identifies the user
Output The user’s balances, and a link to the page with the details
Security The permission list ZZ_ASSIST_USER, which every Assistant user gets
Authentication OAuth 2.0, required

The Application Services Framework calls an application class for each request. The class extends PTCBAPPLSVCDEFN:ApplicationServiceBase and implements its invokeService() method, which reads the request’s inputs through %This.ServiceAPI and sets the method’s output parameters. Oracle’s Plan and Create Application Class tutorial shows the exact code for your PeopleTools release.

For this service, the method does three things:

  1. Finds the user’s employee ID with %EmployeeId, the employee ID on the signed-in user’s profile. It never takes an employee ID from the request, so users can only ever see their own balances.

  2. Reads the balances through a view, such as ZZ_ABS_BAL_VW, that you build over your absence tables, so the service doesn’t depend on how your absence setup stores them:

    The balances query, with %EmployeeId bound to :1
    SELECT PLAN_DESCR, BALANCE_HOURS, AS_OF_DATE
    FROM PS_ZZ_ABS_BAL_VW
    WHERE EMPLID = :1
    ORDER BY PLAN_DESCR
  3. Builds the page link with GenerateComponentContentURL, and returns the balances and the link as the method’s output:

    The output
    {
    "balances": [
    { "plan": "Vacation", "hours": 46.5, "asOf": "2026-09-24" },
    { "plan": "Sick", "hours": 30, "asOf": "2026-09-24" }
    ],
    "page": {
    "label": "Absence Balances",
    "url": "https://hr.example.com/psc/ps/EMPLOYEE/HRMS/c/ZZ_ABSENCE.ZZ_ABS_BAL_FL.GBL"
    }
    }
  1. Create the service. At PeopleTools > Integration Broker > Application Services > Manage Application Services, choose Create Application Service, and name it ZZ_ASSISTANT_HR.

  2. Add the root resource absence, with the Create Root Resource button.

  3. Add the URI template balances. Templates with values in braces, such as {requisitionId}, also need those values defined as base template parameters; this one has none.

  4. Add the GET method to the template, with your application class as its handler, the optional input parameter plan, and the output parameters.

  5. Grant access. Give the permission list ZZ_ASSIST_USER access to the service, or to the root resource.

  6. Require OAuth 2.0 as the method’s authentication, so it accepts the tokens you set up in Connect sign-in.

  7. Activate the service. ASF then generates its OpenAPI description.

Download the OpenAPI description, and save it as specs/zz_assistant_hr.json for the tool catalog.

Call the operation with a test user’s token, using the operation’s URL from the OpenAPI description:

Terminal window
curl -s -H "Authorization: Bearer $TOKEN" "$BALANCES_URL" | jq .

You should get the test user’s balances, in the format above. Then check that PeopleSoft refuses what it should:

  • No token: the request is refused.
  • A user without ZZ_ASSIST_USER: the request is refused, even with a valid token.
  • Two different users: each gets only their own balances.