Skip to content

Commit 8af2827

Browse files
moreautrjeberhard
authored andcommitted
Fix issue-287 - document the X-Requested-By header, fix the documentation for the scale REST endpoint's request body.
1 parent 94e537e commit 8af2827

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

site/rest.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@ You can access most of the REST services using `GET`, for example:
77
* To obtain a list of domains, send a `GET` request to the URL `/operator/latest/domains`.
88
* To obtain a list of clusters in a domain, send a `GET` request to the URL `/operator/latest/domains/<domainUID>/clusters`.
99

10-
All of the REST services require authentication. Callers must pass in a valid token header and a CA certificate file. The `X-Requested-By` header is not required. Callers should pass in the `Accept:/application/json` header.
10+
All of the REST services require authentication. Callers must pass in a valid token header and a CA certificate file. Callers should pass in the `Accept:/application/json` header.
11+
12+
To protect against Cross Site Request Forgery (CSRF) attacks, the Operator REST api requires that you send in a `X-Requested-By` header when you invoke a REST endpoint that makes a change (for example when you POST to the `/scale` endpoint). The value is an arbitrary name such as 'MyClient'. For example, when using curl:
13+
14+
```
15+
curl ... -H X-RequestedBy:MyClient ... -X POST .../scaling
16+
```
17+
18+
If you do not pass in the X-Requested-By header, then you'll get a 400 (bad request) response without any details explaining why the request is bad.
19+
The X-Requested-By header is not needed for requests that only read, for example when you GET any of the Operator's REST endpoints.
1120

1221
If using `curl`, you can use the `-k` option to bypass the check to verify that the operator's certificate is trusted (instead of `curl --cacert`).
1322

site/scaling.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,20 @@ The `/scale` REST endpoint accepts an HTTP POST request and the request body sup
3232

3333
```
3434
{
35-
"configuredManagedServerCount": 3
35+
"managedServerCount": 3
3636
}
3737
```
3838

39-
The `configuredManagedServerCount` value designates the number of WebLogic Server instances to scale to. Note that the scale resource is implemented using the JAX-RS framework, and so a successful scaling request will return an HTTP response code of `204 (“No Content”)` because the resource method’s return type is void and does not return a message body.
39+
The `managedServerCount` value designates the number of WebLogic Server instances to scale to. Note that the scale resource is implemented using the JAX-RS framework, and so a successful scaling request will return an HTTP response code of `204 (“No Content”)` because the resource method’s return type is void and does not return a message body.
40+
41+
When you POST to the `/scale` REST endpoint, you must send in a `X-Requested-By` request value. The value is an arbitrary name such as 'MyClient'. For example, when using curl:
42+
43+
```
44+
curl -v -k -H X-Requested-By:MyClient -H Content-Type:application/json -H Accept:application/json -H "Authorization:Bearer ..." -d { "managedServerCount": 3 } https:/.../scaling
45+
```
46+
47+
If you omit the header, you'll get a 400 (bad request) response without any details explaining why the request was bad.
48+
4049

4150
## What does the operator do in response to a scaling request?
4251

0 commit comments

Comments
 (0)