Hi Everyone,
Thought this might be useful for anyone working with REST APIs in IFS Cloud. Since many of us use APIs for integrations, automation, and data access, I wanted to share a simple approach that combines the power of VS Code, Python, and IFS Cloud REST APIs.
I’ve found this method very convenient because it provides the flexibility of Python development together with the productivity features of VS Code. More importantly, in the long run, this approach becomes:
✅ Reusable
✅ Shareable across teams
✅ Easy to implement and extend
✅ Object-Oriented (OOP-based)
✅ Easier to maintain
✅ Better for structured error handling
This is especially useful if you are developing integration tools or reusable API utilities — not just for REST API testing.
This example demonstrates how to:
✅ Authenticate against IFS Cloud using OAuth2 Client Credentials
✅ Obtain an access token
✅ Call an IFS Projection endpoint using a GET request
Feel free to try it out and share your feedback. Also interested to know what tools, frameworks, or approaches others are using to work with IFS REST API endpoints.
import requests
from requests.auth import HTTPBasicAuth
BASE_URL = "https://your-ifs-instance.build.ifs.cloud"
TOKEN_URL = f"{BASE_URL}/auth/realms/your-realm-name/protocol/openid-connect/token"
CLIENT_ID = "your-client-id"
CLIENT_SECRET = "your-client-secret"
# -------------------------------------------------
# GET ACCESS TOKEN
# -------------------------------------------------
def get_token():
response = requests.post(
TOKEN_URL,
data={
"grant_type": "client_credentials",
"scope": "openid"
},
auth=HTTPBasicAuth(CLIENT_ID, CLIENT_SECRET),
headers={
"Content-Type": "application/x-www-form-urlencoded"
}
)
print("Token Status:", response.status_code)
if response.status_code != 200:
print("Failed to get token")
print(response.text)
return None
return response.json().get("access_token")
# -------------------------------------------------
# CALL IFS REST API (GET)
# -------------------------------------------------
def get_customer_orders(token):
url = (
f"{BASE_URL}"
"/main/ifsapplications/projection/v1/"
"CustomerOrderHandling.svc/CustomerOrderSet"
)
headers = {
"Authorization": f"Bearer {token}",
"Accept": "application/json"
}
response = requests.get(url, headers=headers)
print("API Status:", response.status_code)
if response.status_code == 200:
print("GET Request Successful")
print(response.json())
else:
print("GET Request Failed")
print(response.text)
# -------------------------------------------------
# MAIN
# -------------------------------------------------
if __name__ == "__main__":
token = get_token()
if token:
print("Access token received successfully")
get_customer_orders(token)
else:
print("Authentication failed")
Getting started is very simple:
✅ Install Python
✅ Install VS Code
✅ Install the Python extension for VS Code
✅ Copy the sample code
✅ Replace the authentication details with your IFS Cloud environment values
And you’re ready to go.