Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Solved
  • Unsolved
  • Users
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Darkly)
  • No Skin
Collapse
brainCloud Forums
  1. Home
  2. General
  3. Does a Pre-hook consume an extra API call?

Does a Pre-hook consume an extra API call?

Scheduled Pinned Locked Moved General
cloud code
7 Posts 4 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Travis Brown-John
    wrote on last edited by
    #1

    For example if I set up a pre hook as outlined here: https://getbraincloud.com/apidocs/cloud-code-central/handy-cloud-code-scripts/restrictclientcalls-script/

    Will it consume an extra API call for each API call made from the client? From my testing in the API Explorer, I don't see it registering the pre hook as an extra API call, but there was a discussion on discord that suggested that a whitelist prehook would create an extra api call per invocation.

    Thanks!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Ali Raza
      wrote on last edited by
      #2

      Yes, it will be an extra api call.
      However as its part of cloud script, so if im not mistaken you get 2 more apis calls free so this one shouldnt cost extra.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        Travis Brown-John
        wrote on last edited by Travis Brown-John
        #3

        OK. I don't see the extra api call being flagged in the api explorer though.

        For Example:
        94083baa-69c3-4566-8628-0ce47e381ab1-image.png

        you get 2 more apis calls free so this one shouldnt cost extra.

        If I need to make 3 or more api calls in my custom Cloud Code then I will, in effect, be paying for this call

        1 Reply Last reply
        0
        • Paul WinterhalderP Online
          Paul WinterhalderP Online
          Paul Winterhalder
          brainCloudAdmin
          wrote on last edited by
          #4

          Hi Travis,

          I can confirm that indeed there is an API call count for calling a pre/post hook script - we'll look to see if we can make that clearer in the docs.

          That said, Ali is very correct, like all scripts, the next 3 API calls are free, and scripts after that are 1/2 count each.

          Hope that clarifies things!

          Paul.

          T B 2 Replies Last reply
          0
          • Paul WinterhalderP Paul Winterhalder

            Hi Travis,

            I can confirm that indeed there is an API call count for calling a pre/post hook script - we'll look to see if we can make that clearer in the docs.

            That said, Ali is very correct, like all scripts, the next 3 API calls are free, and scripts after that are 1/2 count each.

            Hope that clarifies things!

            Paul.

            T Offline
            T Offline
            Travis Brown-John
            wrote on last edited by
            #5

            @Paul-Winterhalder @Ali-Raza Thanks for the help!

            1 Reply Last reply
            0
            • Paul WinterhalderP Paul Winterhalder

              Hi Travis,

              I can confirm that indeed there is an API call count for calling a pre/post hook script - we'll look to see if we can make that clearer in the docs.

              That said, Ali is very correct, like all scripts, the next 3 API calls are free, and scripts after that are 1/2 count each.

              Hope that clarifies things!

              Paul.

              B Offline
              B Offline
              Ben Morris
              wrote on last edited by
              #6

              @Paul-Winterhalder

              Apologies for reviving this thread, but does this mean that an operation with a pre hook and a post hook that don't make any API calls of their own count as one API call (pre-hook counts as API call, then operation and post-hook are free). Or does an operation with a pre-hook and a post-hook cost 3 API calls?

              A 1 Reply Last reply
              0
              • B Ben Morris

                @Paul-Winterhalder

                Apologies for reviving this thread, but does this mean that an operation with a pre hook and a post hook that don't make any API calls of their own count as one API call (pre-hook counts as API call, then operation and post-hook are free). Or does an operation with a pre-hook and a post-hook cost 3 API calls?

                A Offline
                A Offline
                Ali Raza
                wrote on last edited by
                #7

                @Ben-Morris unfortunately yes
                they promised to solve it in BC 5.0 though

                1 Reply Last reply
                0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Solved
                • Unsolved
                • Users