Forms app API usage example

Can anybody give an hint on how to use the API from forms?

All routes are easy to find in here:

a simple usage example to get going would actually do:
curl -I --user admin:changemeXX http://localhost:8001/apps/forms/api/v1/forms -H “OCS-APIRequest: true”
HTTP/1.1 302 Found
Date: Mon, 19 Oct 2020 13:15:50 GMT
Server: Apache/2.4.38 (Debian)
Referrer-Policy: no-referrer
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-Robots-Tag: none
X-XSS-Protection: 1; mode=block
X-Powered-By: PHP/7.4.10
Set-Cookie: ocowd52ei5j6=0c74caaadf1e6b2fb8006f0132933d46; path=/; HttpOnly; SameSite=Lax
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: oc_sessionPassphrase=7kL5vGLzfumzo4IcOp48xvkr13WrUoUyNIm%2BaKJdOc5dKxZ4gp1C%2FfkA45tkpouyqudPfbuJ174lPG%2FIHjeGGzHmLPApU0UnYLne%2FUJIyoFQIzvEScirMWu%2FDt6DARum; path=/; HttpOnly; SameSite=Lax
Content-Security-Policy: default-src ‘self’; script-src ‘self’ ‘nonce-UHRwV2h3ekdqaTVFb0VZNFgzVEpJdWNQSUJtTi80T0tKOTdQRGk3WHJWaz06VHV4bXdVV3oxbGNJeVJ4TEZCQ3phOVI0UlVIQ3ljZk9FNG44WkdtaW1TTT0=’; style-src ‘self’ ‘unsafe-inline’; frame-src *; img-src * data: blob:; font-src ‘self’ data:; media-src *; connect-src *; object-src ‘none’; base-uri ‘self’;
Set-Cookie: nc_sameSiteCookielax=true; path=/; httponly;expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax
Set-Cookie: nc_sameSiteCookiestrict=true; path=/; httponly;expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict
Set-Cookie: ocowd52ei5j6=4838299eec52e34595ca1acb1fbd45fb; path=/; HttpOnly; SameSite=Lax
Set-Cookie: cookie_test=test; expires=Mon, 19-Oct-2020 14:15:50 GMT; Max-Age=3600
Location: http://localhost:8001/apps/files/
Content-Type: text/html; charset=UTF-8

moved to category dev - since i think it belongs to there…

@JimmyKater i think it is more how to use something already developed rather than develop work.
But you decide what is best! :slight_smile:

curl -u admin:changemeXX “http://localhost:8001/ocs/v1.php/apps/forms/api/v1/forms” -H “OCS-APIRequest: true”
{“message”:“CSRF check failed”}

curl -u admin:changemeXX “http://localhost:8001/ocs/v2.php/apps/forms/api/v1/forms” -H “OCS-APIRequest: true”
{“message”:“CSRF check failed”}

this works:
curl -u admin:changemeXX “http://localhost:8001/ocs/v1.php/apps/files_sharing/api/v1/shares” -H “OCS-APIRequest: true”

that’s prolly correct. but who else would know about the used APIs other than devs?

2 Likes

Inspired from: https://github.com/nextcloud/forms/issues/603