ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Tool_Box/Relativity_REST_CookieTest.py
Revision: 997
Committed: Tue Mar 17 16:41:26 2026 UTC (10 days, 18 hours ago) by nino.borges
Content type: text/x-python
File size: 1365 byte(s)
Log Message:
updated

File Contents

# Content
1 """
2 Relativity REST Auth Test - Cookie-Based (OIDC/SSO Instance)
3 """
4
5 import requests
6 import json
7
8 ROOT_SITE = "https://your-provider-instance.com"
9
10 # Paste values from Chrome DevTools > Application > Cookies
11 COOKIES = {
12 "RelativityAuth": "paste_value_here",
13 "RelativityIdToken": "paste_value_here",
14 "CSRFHolder": "paste_value_here",
15 "dRelativityId": "paste_value_here",
16 "RULB": "paste_value_here",
17 "a99fd71e-eb1b-4750-a391-5ad8cfe32068": "paste_value_here",
18 }
19
20 # The CSRF header value should match the CSRFHolder cookie value
21 CSRF_TOKEN = "paste_CSRFHolder_value_here"
22
23 headers = {
24 "X-CSRF-Header": CSRF_TOKEN,
25 "Content-Type": "application/json"
26 }
27
28 url = f"{ROOT_SITE}/Relativity.REST/api/Relativity.Objects/workspace/-1/object/query"
29 payload = {
30 "request": {
31 "objectType": {"artifactTypeID": 8},
32 "fields": [{"Name": "Name"}],
33 "rowCondition": ""
34 },
35 "start": 1,
36 "length": 5
37 }
38
39 r = requests.post(url, headers=headers, cookies=COOKIES,
40 data=json.dumps(payload), timeout=15)
41
42 print(f"Status: {r.status_code}")
43 if r.status_code == 200:
44 data = r.json()
45 print(f"Total workspaces visible: {data.get('TotalCount')}")
46 for obj in data.get("Objects", []):
47 print(f" - {obj.get('Values', ['?'])[0]}")
48 else:
49 print(r.text[:500])