Validate rest-api call on create

WordPress Site A has an API, which is being used by another system/application (B). B is struggling to handle/controle/sanitize the posts being sent to the API, and often cause creation of duplicates. B is really struggling to solve this in their end, so I was wondering if I can add a validation-method to the endpoint in my end.

The problem is that it needs to be a validation on a create-endpoint.


This is how I imagines it would look on an update endpoint (not tested):

I’m calling the endpoint: Title&meta[custom_var]=10

add_action( 'rest_api_init', function(){   register_rest_route( 'wp/v2', '/foobar/(?P<id>\d+)', [     'methods'  => 'POST',     'args'     => [       'custom_var' => [         'validate_callback' => function( $  param, $  request, $  key ){           if( $  param > 5 ){             return true           }           return false;         },       ],     ],   ] ); } ); 

But I can’t find anything in the rest documentation about validating the create endpoint.

I imagined it being something like this:

add_action( 'rest_api_init', function(){   register_rest_route( 'wp/v2', '/foobar/', [     'methods'  => 'POST',     'validate_method' => function( ... ),     ...     ...     ...   ] ); } ); 

… But that doesn’t work.

I also considered doing the callback:

add_action( 'rest_api_init', function(){   register_rest_route( 'wp/v2', '/foobar/', [     'methods'  => 'POST',     'callback' => function( ... ),     ...     ...     ...   ] ); } ); 

But that callback fires after the post is created (I assumed).

After new user logs in or signs up, make a POST call in WordPress

What I am trying to achieve is this: after a user either signs in or signs up on my e-commerce site, I want to trigger a POST call to an endpoint on POSTMAN that will show the data like username, email, password, etc.

I am new to WordPress development so can someone help guide me to where to access the code on WordPress and furthermore make this POST call? Any help is much appreciated!

Also, I am using Woo Commerce if that factors in at all

Can SSIS packages call other SSIS packages in the connection string?

I am running an SSIS package that transfers data from one (SQL2008) server to another (SQL2000). However after P2V conversion the SQL2008 server cannot execute an SSIS package due to a user authentication error.

Lets say the package is called "Transfer-Go". In the connection string of that package can it call another SSIS package? In the SSIS library there is another package with the same that appears in the string (called Transfer-Now) name The string is below:

Data Source=<IP>;User ID=<user>;Initial Catalog=<db_name>;Provider=SQLNCLI10.1;Persist Security Info=True;OLE DB Services=-13;Auto Translate=False;Application Name=SSIS-<Transfer-Now-name of other SSIS package>-{8ABA18EE-637E-424F-A3F7-F7E4EA50DD9D}<IP.db_name.user>; 

So is this SSIS package connection string calling that package?

And if the credentials are wrong in that package could that be why I am unable to authenticate?

Thanks for any input, not a DB/SQL guy at all so I apologize if I sound green here.

MySQL – Call a View inside a Stored Procedure

Let’s say, I have a table as follows


id             name                 status               usertype                         flag ================================================================================================ 1              Name 1                  1                    2                               0 2              Name 2                  1                    3                               0 3              Name 3                  1                    1                               0 4              Name 4                  1                    4                               0 5              Name 5                  1                    5                               0  


<select id="type" name="type">    <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option>  </select> 

My requirement is that I need to get all the data from table where the usertype is selected from the html page by the user (could be 1, 2, 3,4,5, etc.)

I want to create a view, and call that inside stored procedure

I cannot pass an argument inside of a View. So, I was told to create a stored procedure, and call the view inside it. The problem is, I don’t know how to do it.

how to call lo_unlink(lo) in batches

I have a huge vacuum_l table filled with oids I can safely delete. As reported in the vacuumlo.c source code:

We don’t want to run each delete as an individual transaction, because the commit overhead would be high. However, since 9.0 the backend will acquire a lock per deleted LO, so deleting too many LOs per transaction risks running out of room in the shared-memory lock table. Accordingly, we delete up to transaction_limit LOs per transaction.

What is the best way to write a script iterating through the whole table and limiting the calls to lo_unlink() to n per transaction?

So far I tried to rewrite the vacuumlo.c sources in sql:

begin; DECLARE myportal CURSOR WITH HOLD FOR SELECT lo FROM vacuum_l; for recordvar IN myportal loop -- this won't work     begin;     FETCH FORWARD 500 FROM myportal;     -- call to lo_unlink() here     commit; end loop; 

Using vacuumlo utility is not an option for me since hybernate stored oids in text field.

Thanks for any help.

Can you cast Call Lightning while submerged underwater? [duplicate]

We are running an underwater campaign where everyone is an aquatic race, and most of the campaign will take place completely underwater. Call Lightning says:

"A storm cloud appears in the shape of a cylinder that is 10 feet tall with a 60-foot radius, centered on a point you can see within range directly above you. The spell fails if you can’t see a point in the air where the storm cloud could appear (for example, if you are in a room that can’t accommodate the cloud)."

Does this literally mean you must be able to see a point "in the air", or could this work beneath the waves?

Are there official rules for drugs and addiction in Call of Cthulhu?

I’m playing the 7ed version of Masks of Nyalethotep(sp?). I decided to have my character a laudanum user as he’s an opium addict, because I was certain there were rules about narcotics and drug addiction in Call of Cthulhu.

But now I can’t find any in the main rulebooks (I have 5th to 7th edition), investigator and keeper handbooks, or other sourcebooks and campaigns I have.

Are there any official rules for PCs using narcotics and for addiction?

If there are, which book are they in?

At the last session, myself and the GM decided to give my PC a penalty dice on skill and characteristic rules and movement, and to reduce the effects of Sanity rolls (sometimes he won’t make them, if he does the sanity costs might be reduced), when he’s under the influence of laudanum

I think my DM is consistently faking dice rolls for saves against a specific spell; how do I call my DM out?

I’ve been watching one of our players repeatedly cast toll the dead (Xanathar’s Guide to Everything, p. 169), across seven sessions, and a dozen different combat encounters, and the DM has never once allowed her to do any damage with the cantrip. She has a spell save DC of 16, yet our DM always “mysteriously” rolls the saving throw.

Obviously, “just quit the game”, “that group is not for you”, are the answers most folks will immediately suggest, but I’m not the one playing a warlock and I feel like telling her to quit would be awfully rude of me. She’s a really quiet and shy person, and I can’t help feeling like someone needs to stand up and defend her. Last session she looked like she was on the verge of tears.

Anyone have a creative method of calling your DM out for being a dice cheat in front of the entire group? I’m really disgusted by his behavior and I’m guessing that statistically speaking the permutation is so large by this point that his monsters have won the powerball ten times over.