davilo61
davilo61

Reputation: 43

Cypress API request - errors for not a function

I'm struggling to find the expected syntax for an OKTA 'List users with a search' Cypress API request.

url: 'https://companydomain/api/v1/users/?search=profile.lastName eq'`${searchTerm}`,
url: 'https://companydomain/api/v1/users/?search=profile.lastName eq "autotest"',

The example above with the jquery variable fails for profile.lastName eq" is not a function. The hard-coded example with "autotest" succeeds. I've tried several different ways, but can't seem to add a variable within that API. Any help is greatly appreciated!

Upvotes: 0

Views: 353

Answers (1)

pavelsaman
pavelsaman

Reputation: 8322

String interpolation in JS looks like this:

url: `https://companydomain/api/v1/users/?search=profile.lastName eq "${searchTerm}"`,

You have to have backticks around the whole string.

Upvotes: 3

Related Questions