Skip to content

Make examples the same order and params #1705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions guides/providing-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -1138,9 +1138,9 @@ module.exports = class Sue extends cds.Service {
```js
GET .../sue/sum(x=1,y=2) // unbound function
GET .../sue/stock(id=2) // unbound function
POST .../sue/add {"x":1,"to":2} // unbound action
POST .../sue/add {"x":11,"to":2} // unbound action
GET .../sue/Foo(2)/Sue.getStock() // bound function
POST .../sue/Foo(2)/Sue.order {"x":1} // bound action
POST .../sue/Foo(2)/Sue.order {"x":3} // bound action
```

> Note: You always need to add the `()` for functions, even if no arguments are required. The OData standard specifies that bound actions/functions need to be prefixed with the service's name. In the previous example, entity `Foo` has a bound action `order`. That action must be called via `/Foo(2)/Sue.order` instead of simply `/Foo(2)/order`.
Expand All @@ -1158,8 +1158,8 @@ POST .../sue/Foo(2)/Sue.order {"x":1} // bound action
const srv = await cds.connect.to('Sue')
// unbound actions/functions
await srv.send('sum',{x:1,y:2})
await srv.send('add',{x:11,to:2})
await srv.send('stock',{id:2})
await srv.send('add',{x:11,to:2})
// bound actions/functions
await srv.send('getStock','Foo',{id:2})
//for passing the params property, use this syntax
Expand All @@ -1176,8 +1176,8 @@ POST .../sue/Foo(2)/Sue.order {"x":1} // bound action
const srv = await cds.connect.to(Sue)
// unbound actions/functions
srv.sum(1,2)
srv.add(11,2)
srv.stock(2)
srv.add(11,2)
// bound actions/functions
srv.getStock('Foo',2)
srv.order('Foo',2,3)
Expand Down
Loading