Interviewer - Server > Architecture > Interview Service tier > Quota web service > Testing the Quota API web service
 
Testing the Quota API web service
To test the Quota API, you can use Fiddler (download from http://www.telerik.com/fiddler). This section describes some example tests.
Set up quota project and user
1 Activate a quota project, and then create a user, for example:
Username: QuotaUser
Password: Quota1234User
2 Assign the quota project and all the quota activities to this user in User Administration.
Get version
1 In Fiddler, click the Composer tab, and then click Scratchpad.
2 Copy this entire set of notes to the Scratchpad.
The Fiddler Scratchpad is useful to hold a set of HTTP requests
3 Click the request that you want to execute, and then click the Execute toolbar button.
4 Change the URL and host value in all the queries to the server that hosts the Quota API web service. You must change the values in both the URL and the Host lines.
GET https://10.200.1.194/SPSSMR/API/UserAuth/Version HTTP/1.1
User-Agent: Fiddler
Accept: application/xml
Host: 10.200.1.194
User logon
1 To logon, you must create an authorization string:
QuotaUser: Quota1234User
2 Use Tools menu, TextWizard and ToBase64 to create the authorization string and copy it to the Authorization: Basic line.
Logon returns a user session ID which is used to identify the user session.
3 To retrieve the user session ID, double‑click the Logon URL in the left status pane.
The Response Headers appear in the bottom‑right pane.
4 On the Raw tab, you can copy the user session ID into the rest of the URLs.
GET https://10.200.1.194/SPSSMR/API/UserAuth/Logon HTTP/1.1
User-Agent: Fiddler
Accept: application/xml
Authorization: basic UXVvdGFVc2VyOlF1b3RhMTIzNFVzZXI=
Host: 10.200.1.194
5 When you have executed a URL, double‑click the status to display the output in the Response view.
To see the HTTP header, use Headers.
To see the contents, use TextView or XML.
Quota logon
Quota logon needs the following header variables, using data returned by a UserAuth Logon request.
Authorization: "Ticket" followed by the base64 encoded username and ticket in the form <username>:<ticket>. This is the same as for the /UserAuth/Logon: see /UserAuth/Logon URL.
UserSessionId: The UserSessionId returned by a UserAuth Logon request.
Quota logon returns an application session ID which is used in reading quotas and updating quotas.
GET https://10.200.1.194/SPSSMR/API/quota/Logon HTTP/1.1
User-Agent: Fiddler
Accept: application/xml
Authorization: ticket dWl4YXNcbXJwZHRlc3Q6OGJiOWM4ODQtMTcwNS00NjUyLWI5NGUtMmEwMDBhM2JjMzQx
UserSessionId: b49199d4-c719-4f34-b193-f3937de00119
Host: 10.200.1.194
Get quota project list
GET https://10.200.1.194/SPSSMR/API/quota/Projects HTTP/1.1
User-Agent: Fiddler
Accept: application/xml
ApplicationSessionId: c17faec7-98b7-49eb-8689-6aab972dbbfa
Host: 10.200.1.194
Get a certain quota project information
GET https://10.200.1.194/SPSSMR/API/quota/Projects/[ProjectName] HTTP/1.1
User-Agent: Fiddler
Accept: application/xml
ApplicationSessionId: c17faec7-98b7-49eb-8689-6aab972dbbfa
Host: 10.200.1.194
Get quota group information
GET https://10.200.1.194/SPSSMR/API/quota/Projects/[ProjectName]/QuotaGroups HTTP/1.1
User-Agent: Fiddler
Accept: application/xml
ApplicationSessionId: c17faec7-98b7-49eb-8689-6aab972dbbfa
Host: 10.200.1.194
Get a certain quota group information
GET https://10.200.1.194/SPSSMR/API/quota/Projects/[ProjectName]/QuotaGroups/[GroupName] HTTP/1.1
User-Agent: Fiddler
Accept: application/xml
ApplicationSessionId: c17faec7-98b7-49eb-8689-6aab972dbbfa
Host: 10.200.1.194
Get quota details in a certain quota group
https://10.200.1.194/SPSSMR/API/quota/Projects/[ProjectName]/QuotaGroups/[GroupName]/Quotas HTTP/1.1
User-Agent: Fiddler
Accept: application/xml
ApplicationSessionId: c17faec7-98b7-49eb-8689-6aab972dbbfa
Host: 10.200.1.194
Get all quotas in all groups for the requested project
GET https://10.200.1.194/SPSSMR/API/quota/Projects/[ProjectName]/Quotas HTTP/1.1
User-Agent: Fiddler
Accept: application/xml
ApplicationSessionId: c17faec7-98b7-49eb-8689-6aab972dbbfa
Host: 10.200.1.194
Update a single quota
Patch http://10.2.40.147/SPSSMR/API/Quota/projects/[ProjectName]/QuotaGroups/[QuotaGroup]/Quotas/[QuotaName]
HTTP/1.1
User-Agent: Fiddler
Content-type: application/xml
ApplicationSessionID: ff1db2b9-f3f7-4eb5-9632-6277dd14bdda
<Quota AllowOverQuota="True" IsCounterOnly="True" Target="10" Completed="0" />
Update all quotas in a quota group
Patch http://10.2.40.147/SPSSMR/API/Quota/projects/[ProjectName]/QuotaGroups/[QuotaGroup]/Quotas
HTTP/1.1
User-Agent: Fiddler
Content-type: application/xml
ApplicationSessionID: ff1db2b9-f3f7-4eb5-9632-6277dd14bdda
<QuotaGroup Target="10" Completed="0" />
See also
Quota web service