Link Search Menu Expand Document
Consortium of European Social Science Data Archives

RESTful HTTP

Trigger validation with curl

Use resolvable URLs for document and/or profile

HOSTNAME=https://cmv[-dev].cessda.eu
DOCUMENT_URL=https://bitbucket.org/cessda/cessda.cmv.core/raw/ad7e3ffd847ecb9c35faea329fbc7cfe14bfb7a6/src/main/resources/demo-documents/ddi-v25/ukds-2000.xml
PROFILE_URL=https://bitbucket.org/cessda/cessda.cmv.core/raw/ad7e3ffd847ecb9c35faea329fbc7cfe14bfb7a6/src/main/resources/demo-documents/ddi-v25/cdc25_profile.xml

# If endpoint is secured with HTTP Basic Auth, add option --user $USERNAME:$PASSWORD
curl -s $HOSTNAME/api/V0/Validation \
  --request 'POST' \
  --header 'accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "document": {
    "uri": "'"$DOCUMENT_URL"'"
  },
  "profile": {
    "uri": "'"$PROFILE_URL"'"
  },
  "validationGateName": "BASIC"
}'

Use JSON-escaped XML-content of document and/or profile

DOCUMENT_CONTENT=`curl -s $DOCUMENT_URL | jq -Rs .` # Escaping XML to JSON is still not correct!

curl -s $HOSTNAME/api/V0/Validation \
  --request 'POST' \
  --header 'accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "document": {
    "content": "'"$DOCUMENT_CONTENT"'"
  },
  "profile": {
    "uri": "'"$PROFILE_URL"'"
  },
  "validationGateName": "BASIC"
}'

Trigger validation with Swagger / OpenAPI 3.0

Please note: There is an integration problem with Swagger and Spring-Boot reported: Swagger does not reuse configured Jackson objectMapper Spring bean

Step 1

Step 1

Step 2

  • Click on endpoint POST /api/V0/Validation (green box)
  • Click on the button Try it out

Step 2

Step 3

Step 3

Step 4

  • Scroll down and see constraint violation messages in the response body
  • If this list is empty, the document is valid

Step 4