The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

38 lignes
1.3 KiB

  1. #!/bin/bash
  2. #
  3. # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
  4. #
  5. # Run an HTTP GET against the API, then print out the "uuid" attribute only, and only the first one
  6. #
  7. # Usage:
  8. #
  9. # bgeti1 path [options]
  10. #
  11. # path : an API path
  12. # options : bscript options, see bubble.main.BubbleScriptOptions (and parent classes) for more info
  13. #
  14. # Environment variables
  15. #
  16. # BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env)
  17. # BUBBLE_USER : account to use. Default is root@local.local
  18. # BUBBLE_PASS : password for account. Default is password
  19. # BUBBLE_INCLUDE : path to look for JSON include files. default value is to assume we are being run from
  20. # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model.
  21. #
  22. SCRIPT="${0}"
  23. SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd)
  24. . ${SCRIPT_DIR}/bubble_common
  25. URL="${1:?no URL provided}"
  26. shift
  27. JSON="$(BUBBLE_QUIET=1 ${SCRIPT_DIR}/bubble get -U ${URL} ${@})"
  28. if [[ ${JSON} = \{* ]] ; then
  29. echo "${JSON}" | jq -r .uuid
  30. elif [[ "${JSON}" = \[* ]] ; then
  31. echo "${JSON}" | jq -r .[].uuid | head -1
  32. else
  33. die "Invalid JSON received:
  34. ${JSON}"
  35. fi