### Get CSRF-Token
# @name tokenResponse
HEAD https://url.com/api/endpoint HTTP/1.1
Authorization: Basic {{$dotenv auth_base64}}
x-csrf-token: Fetch
@x-csrf-token = {{ tokenResponse.response.headers.x-csrf-token }}
### Use Token
POST https://url.com/api/endpoint HTTP/1.1
Authorization: Basic {{$dotenv auth_base64}}
Content-Type: application/json
x-csrf-token: {{x-csrf-token}}
{
"data" : 1
}
Tag: VSC
[BTP] Get access token for specific tenant in a multitenant scenario using http rest client
https://docs.cloudfoundry.org/api/uaa/version/4.6.0/index.html#password-grant
# url from XSUAA Service Key, but replace in the url the provider subdomain with the consumer subdomain (the tenant you want to call)
@xsuaaUrl = {{$dotenv xsuaaUrl}}
# clientid from XSUAA Service Key
@xsuaaClientId = {{$dotenv xsuaaClientId}}
# clientsecret from XSUAA Service Key
@xsuaaClientSecret = {{$dotenv xsuaaClientSecret}}
@username = {{$dotenv btp_username}}
@password = {{$dotenv btp_password}}
### Get Access Token for Cloud Foundry using Password Grant with BTP default IdP
# @name getXsuaaToken
POST {{xsuaaUrl}}/oauth/token
Accept: application/json
Authorization: Basic {{xsuaaClientId}}:{{xsuaaClientSecret}}
Content-Type: application/x-www-form-urlencoded
grant_type=password
&username={{username}}
&password={{password}}
&response_type=token
### Store access token
@access_token = {{getXsuaaToken.response.body.$.access_token}}
[SuccessFactors] OData V2 – filter in (VSC Rest-API Client)
When filtering an OData V2 endpoint, you can simply list your values separated by a comma after the keyword in
(option 2). Much shorter than having to repeat your filter statement all the time, like in option 1.
@user1=10010
@user2=10020
### Option 1: Filter userId using OR condition
GET {{$dotenv api_url}}/odata/v2/User?$filter=userId eq '{{user1}}' or userId eq '{{user2}}'
Authorization: Basic {{$dotenv api_auth}}
Accept: application/json
### Option 2: Filter userId using IN condition
GET {{$dotenv api_url}}/odata/v2/User?$filter=userId in '{{user1}}', '{{user2}}'
Authorization: Basic {{$dotenv api_auth}}
Accept: application/json
[VSC] Create/Read/Delete File in CMIS Repository via VSC Rest-API Client
API Specification: http://docs.oasis-open.org/cmis/CMIS/v1.1/os/examples/browser/
Helpful Postman Collection: https://gist.github.com/aborroy/3f1f2360b0e85067675643aa648a8112
Create:
@folderId = <myFolderID>
@fileName = <myFileName>
### Create Object
# @name object
POST http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root
Authorization: Basic user:password
Content-Type: multipart/form-data; boundary=boundary
--boundary
Content-Disposition: form-data; name="succinct"
Content-Type: text/plain; charset=utf-8
true
--boundary
Content-Disposition: form-data; name="cmisaction"
Content-Type: text/plain; charset=utf-8
createDocument
--boundary
Content-Disposition: form-data; name="objectId"
Content-Type: text/plain; charset=utf-8
{{folderId}}
--boundary
Content-Disposition: form-data; name="propertyId[0]"
Content-Type: text/plain; charset=utf-8
cmis:name
--boundary
Content-Disposition: form-data; name="propertyValue[0]"
Content-Type: text/plain; charset=utf-8
{{fileName}}
--boundary
Content-Disposition: form-data; name="propertyId[1]"
Content-Type: text/plain; charset=utf-8
cmis:objectTypeId
--boundary
Content-Disposition: form-data; name="propertyValue[1]"
Content-Type: text/plain; charset=utf-8
cmis:document
--boundary
Content-Disposition: form-data; name="content"; filename=image.png
Content-Type: image/png
Content-Transfer-Encoding: binary
< image.png
--boundary--
### Fill Variable from Response
@ID = {{object.response.body.succinctProperties.cmis:objectId}}
Read:
### Get Object properties
GET http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root
?cmisselector=properties
&objectId={{ID}}
Authorization: Basic user:password
### Get Object content
GET http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root
?cmisselector=content
&objectId={{ID}}
Authorization: Basic user:password
### Get Object content stream
GET http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root
?getContentStream
&objectId={{ID}}
Authorization: Basic user:password
Delete:
### Delete Object
POST http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root
Authorization: Basic user:password
Content-Type: multipart/form-data; boundary=boundary
--boundary
Content-Disposition: form-data; name="objectId"
Content-Type: text/plain; charset=utf-8
{{ID}}
--boundary
Content-Disposition: form-data; name="cmisaction"
Content-Type: text/plain; charset=utf-8
delete
--boundary--
[VSC] Post form-data via VSC Rest-API Client
Next to the .http file in the same folder, place your .env for hostname and authorization and the file you want to upload.
The parameter name="file"
stands for the key that the files should belong to.
### Post form-data
POST {{$dotenv hostname}}/my/endpoint HTTP/1.1
Authorization: Basic {{$dotenv auth_in_base64}}
Content-Type: multipart/form-data; boundary=boundary
Accept: */*
--boundary
Content-Disposition: form-data; name="file"; filename="image.png"
Content-Type: image/png
< ./image.png
--boundary--
[CAP] UploadSet http test file
How to create an uploadSet in combination with a CAP backend: https://blogs.sap.com/2021/08/18/my-journey-towards-using-ui5-uploadset-with-cap-backend/
You can test the uploadSet CAP backend part using these http calls:
### Create file
# @name file
POST http://localhost:4004/v2/admin/Files
Authorization: Basic admin:
Content-Type: application/json
{
"mediaType": "image/png",
"fileName": "picture.png",
"size": 1000
}
### Fill Variable from Response
@ID = {{file.response.body.$.d.ID}}
### Upload Binary PNG content
PUT http://localhost:4004/v2/admin/Files({{ID}})/content
Authorization: Basic admin:
Content-Type: image/png
< ./picture.png
### Get uploaded png
GET http://localhost:4004/v2/admin/Files({{ID}})/content
Authorization: Basic admin:
The picture.png file must be in the same folder as the http test file.
[SuccessFactors] Get manager and his employees via API
@my_endpoint=api2.successfactors.eu
@userId=managerId
### Query manager and his employees
GET https://{{my_endpoint}}/odata/v2/User('{{userId}}')?
$format=json&
$expand=directReports&
$select=firstName,lastName,email,teamMembersSize,directReports/firstName,directReports/lastName,directReports/userId,directReports/email
[Git] Error on Windows using VSCode Dev Container
After connecting to a local dev container using Visual Studio Code and trying to clone a private project from Github I got the following error:
Cloning into 'myProject'...
warning: url has no scheme: helperselector
fatal: credential url cannot be parsed: helperselector
The only way I could remove this error was deleting the helperselector settings. So open the git config with:
git config --edit --global

and remove the the helperselector block (the first two lines). You will now get asked again for your credentials when cloning a project.
[VSC] Extensions
Open-source registry for VS Code extensions: https://open-vsx.org/
Coden
https://marketplace.visualstudio.com/items?itemName=CoenraadS.bracket-pair-colorizer-2
https://marketplace.visualstudio.com/items?itemName=vscode-icons-team.vscode-icons
https://marketplace.visualstudio.com/items?itemName=mechatroner.rainbow-csv
Git
https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens
https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph
Markdown
https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one
https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint
https://marketplace.visualstudio.com/items?itemName=ban.spellright
Docker
https://marketplace.visualstudio.com/items?itemName=formulahendry.docker-explorer
WSL
https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl