Now accepting guest editorial from SAP, Oracle, Workday and ServiceNow practitioners.Pitch a guide
The Sign-Off Table

Lesson 1 of 6

Anatomy of an SAP OData call

10 min

Listen to this lesson

0:00 / 18:17

Course sap-tst-209 showed what an OData response means to a tester; sap-int-202 showed how services are built and activated. This course is the hands-on part: you send the calls yourself. Any HTTP client works. Postman, Bruno and curl are common choices, and nothing in the course depends on one of them. What matters is that you can read every part of a request and predict the response before you send it.

The parts of a URL

PartExample (OData V2)What it tells you
Hosthttps://sandbox.api.sap.com/s4hanacloud or your system's hostWhich system answers; the sandbox prefix differs from a real system
Service root/sap/opu/odata/sap/API_BUSINESS_PARTNERV2 services on SAP Gateway live under /sap/opu/odata/; V4 services under /sap/opu/odata4/
Entity set/A_BusinessPartnerThe collection you read or write
Key('17100001')One entity; key fields and quoting come from the metadata
Navigation/to_BusinessPartnerAddressA related collection, defined as a navigation property
Query options?$select=BusinessPartner,BusinessPartnerFullName&$top=5Shape and size of the result

Reading a Business Partner API URL from left to right.

Part of the API_BUSINESS_PARTNER model: navigation properties connect the business partner to its addresses, roles and customer or supplier data.
The Sign-Off Table · thesignofftable.com/academy/sap-tst-211

Read $metadata before anything else

Every OData service describes itself at $metadata. It lists the entity types, their key fields, property types and lengths, which properties may be filtered or sorted, the navigation properties and, for V2 services from SAP Gateway, SAP annotations such as sap:creatable, sap:updatable and sap:filterable. A tester who reads the metadata first avoids half of the usual mistakes: filtering on a property that is not filterable, sending a 12-character value into a 10-character field, or expecting an update on a read-only property to work.

OData V2 and V4 side by side

TopicOData V2 (for example API_BUSINESS_PARTNER)OData V4 (for example Sales Order (A2X), CE_SALESORDER_0001)
Path on SAP Gateway/sap/opu/odata/sap/<service>/sap/opu/odata4/... (service group, repository, service, version)
JSON envelopeResult under d, collections under d.resultsCollections under value; annotations such as @odata.etag
Count$inlinecount=allpages or /$count$count=true or /$count
Partial updateMERGE (or PATCH where supported)PATCH
Next page link__next@odata.nextLink
Substring filtersubstringof('x',Field)contains(Field,'x')
The differences that break copied requests when a test moves from a V2 to a V4 API.
The Sign-Off Table · thesignofftable.com/academy/sap-tst-211

Setting up the sandbox

  1. Open the SAP Business Accelerator Hub (api.sap.com) and sign in with an SAP account.
  2. Search for Business Partner (A2X), the API_BUSINESS_PARTNER service for SAP S/4HANA Cloud, and open it.
  3. Choose Show API Key and copy your personal key. Treat it like a password: do not paste it into shared files or screenshots.
  4. Open the API reference or configuration details and copy the sandbox URL.
  5. In your HTTP client, create a GET request to the sandbox URL plus /A_BusinessPartner?$top=3, add the header APIKey with your key and Accept: application/json, and send it.
  6. Check the result: status 200, a JSON body with three business partners, and response headers you can inspect.

Reading your first response

Send GET /A_BusinessPartner?$top=3 to the sandbox and look at the JSON before you look at anything else. In a V2 service everything sits under d, and a collection is the array d.results. Each entry carries a __metadata object with its uri (the canonical URL of that entity, which you can call directly), its type and, for services that use them, its etag. Navigation properties you did not expand appear as __deferred objects holding a URL: the data is not there, only the address where it can be fetched. Dates in V2 JSON look like /Date(1767225600000)/, milliseconds since 1970; V4 uses ISO dates such as 2026-01-01.

Status on a readMeaningFirst thing to check
200 OKThe request worked; the data may still be wrong or incompleteBusiness values and next links
400 Bad RequestSyntax error in the URL or query optionsQuotes, property names, encoding
401 UnauthorizedNo valid credentials or API keyHeader name and key or user
404 Not FoundWrong path, inactive service or a key that does not existService root, key format, client

Read responses and what to check first.

Two more requests are worth sending once on any new service. GET on the service root returns the service document: the list of entity sets the service exposes. GET $metadata returns the model. Save both with the date and the system: after an upgrade, comparing the saved metadata with the new one is the fastest way to see what changed in the API your tests depend on.

Same API, two targets: the sandbox teaches reads; the real system adds authentication, CSRF and Contoso's own data.
The Sign-Off Table · thesignofftable.com/academy/sap-tst-211

What would you do?

Wei asks you to prove that Great Lakes Fleet Services (business partner 17100001) has the customer role in CMQ. You have the sandbox working and a communication user for CMQ. What is the best first request?

Key points
  • Read a URL as host, service root, entity set, key, navigation and query options.
  • Read $metadata first: keys, types, lengths and what is filterable or updatable.
  • V2 and V4 differ in path, JSON envelope, count, paging links and filter functions.
  • The Accelerator Hub sandbox uses an APIKey header and is read-only; writes need a test system.

Check your understanding · not graded

Lesson check

  1. 1. Where do V2 services on SAP Gateway usually live?

  2. 2. What should you read first to know which properties can be filtered?

  3. 3. Which header does the Accelerator Hub sandbox expect?

  4. 4. Why can a test pass in the sandbox but fail on CMQ?