Skip to main content

Drupal how to use user PATCH API

To PATCH a user is to update an existing user... actually the current user logged in.

Drupal REST POST an image

To POST an image is similar to the other posts mentioned on this site.  This article works through the steps to post an image.

To be able to get, patch or post you need to log in the member so you can retrieve their user id (uid).

Calling a query

To POST an image, the details required are:

PHP - sort a multidimensional array

To sort through a multidimensional array seems to be a function that I occasionally call on.  Handy to have referenced here:

Setting up for hal_json RESTful services

The development version of the app database is held on the staging site.  Note all development and testing will be completed on the staging site.

Drupal 9 uses:

  • HAL : Serializes entities using Hypertext Application Language.
  • RESTful Web Services

For testing purposes you can use either of the following Chrome extensions:

  • Postman;
  • DHC

 

RESTful query user - Drupal

The user parameters provides details about a specific user based on the following parameters:

  • User uid;

The output of this query will return user profile data only of the fields containing data.  An example of the data returned includes, but is not limited to the following:

REST API Drupal user

The user API, was originally created under the General Documenation area (see Query - user).  I'm creating a new user API document under the API documentation area.

Calling a query

To call a user query the details are required:

Importing and Exporting a MySQL database with Drush

These steps are for Drupal 8 and 9.

 

Export your database

Order here is important.  First you want to clear all the Drupal caches.  Then export / dump the db the sql database to a file in your home directory.

drush cr
drush sql-dump > path/to/your/file/ourpout/sql-dump-file-name.sql

or

Subscribe to Drupal