An overview of the

Using Drupal8 as the back-end data management platform, the front end calls the data interface through the API. Drupal8 decouples data seamlessly with applets and mobile apps.

API specification: REST and JSON: API and GraphQL

REST is one of the most powerful technical specifications, and for JSON: APIS, the results are positive.

This information helps us choose JSON: API as the basic specification with useful documentation.

Authentication methods: Basic authentication with OAuth

Unless used in conjunction with some external Security system (such as TLS, Transport Layer Security, [RFC5246]), this scheme is not considered a secure method for user authentication because user ids and passwords are passed over the network in clear text.

“Basic” HTTP authentication scheme document

In OAuth, a client requests access to a resource controlled by the resource owner and hosted by the resource server, and issues a different set of credentials to the client than the resource owner’s credentials. Instead of using the resource owner’s credentials to access a protected resource, the client obtains an access token – a string representing a specific scope, lifetime, and other access properties.

OAuth 2.0 authorization framework documentation

According to the official specification of these methods, we can see some conclusions about their use in the work. Therefore, explicitly choose to support OAuth! But can we quickly set it up and use it? Yes, the Simple OAuth module will help.

Install Drush

composer require drush/drush
Copy the code

Install the Devel module to generate test article content

composer require drupal/devel
Copy the code
  • Start the content generator module, check and save.

  • Generate test content.

Use the Simple Oauth module to control permissions

  • Installing an Expansion Module
composer require drupal/simple_oauth
Copy the code
  • To enable the module
drush en -y simple_oauth

Copy the code

Before using it, we must limit the permissions of the default Authenticated User role. However, it is best to create a new role on the Roles page (/admin/ People/Roles) to use with the API.

Generate the key

  • Came to/admin/config/people/simple_oauth page setup.

  • Click the “Generate key” button in the lower right corner.

  • Enter the key storage path. (Recommended to be placed outside the site directory)

  • Click the Generate button.

  • Click the “Save Configuration” button.

Add access roles, users, and permissions

  • Add roles. Such as: oauthapi.

  • Add a user and assign the API role. Save.

  • Assign corresponding access permissions to API roles. For example: create articles, view published content, and so on.

Create a client service

  • Came to/admin/config/services/consumer client list page.

  • Click the “Add Customer” button.

  • Fill in the label name, set a new password, and tick scopes. Save.

Test the interface with Postman

  • Create and validate access tokens

Now that we have configured the simple OAuth module, we need to request access to the token/OAuth /token from the resource located there. The OAuth 2.0 specification states that An OAuth token resource on an authorized server must only accept requests for posts whose body format is form-data or X-www-form-urlencoded, and all JSON-formatted bodies will be rejected.

  • You need the following parameters to appear in the request body.

Grant_type: in most cases, password. Client_id: UUID of the user in the previous section. Client_secret: Client secret provided when adding a user. Username: indicates the username of the account associated with the user. Password: indicates the password of the account associated with the user. Scope: Specifies the visitor role.

  • The access token.
curl --location --request POST 'http://d890.com/oauth/token' \
--form 'grant_type=password' \
--form 'client_id=93d8965b-d8df-4ef0-b887-97a675f968f1' \
--form 'client_secret=abc123' \
--form 'username=test' \
--form 'password=1' \
--form 'scope=oauthapi'
Copy the code
  • Returns a token.
{
    "token_type": "Bearer"."expires_in": 869999,
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjE5MzdmMWM1YTU2OWJkZDIxZmJhMDJlYjhiOWQyYTFlMWY5ZGEzNzEwOGFmNTQ4YzNjYTg1ZDY 5YjVkNGJlMmI0NGIzYzZjMTdlNGM0Mzk5In0.eyJhdWQiOiI5M2Q4OTY1Yi1kOGRmLTRlZjAtYjg4Ny05N2E2NzVmOTY4ZjEiLCJqdGkiOiIxOTM3ZjFjNWE 1NjliZGQyMWZiYTAyZWI4YjlkMmExZTFmOWRhMzcxMDhhZjU0OGMzY2E4NWQ2OWI1ZDRiZTJiNDRiM2M2YzE3ZTRjNDM5OSIsImlhdCI6MTU5MjA5NDUzMiw ibmJmIjoxNTkyMDk0NTMyLCJleHAiOjE1OTI5NjQ1MzEsInN1YiI6IjUiLCJzY29wZXMiOlsib2F1dGhhcGkiLCJhdXRoZW50aWNhdGVkIl19.J29rBtkl4p wde6b3Xf3bYiyv_w2pwMEQdtDI1YztqNZFm-rTvLFu_MkV3CDsfOi9YHp13d1RhMlz7JbYXylTlaPET9U6IjAI1SeEFV_ZqKxHC1z9LTXR-bxgzGToi7QqoV Ka6ZiFPJgGdfhFsPxi6KD-zK1RUPmW5ueGpHM6U9JMPuh-ZL-mO69If36HJOhBR5eld0VDX_SMBq_4a-WJSOQmrzFxICo6Tqh34xLmNeSk3eiCE5hUij_Mjc FHJ3jWnCNRh-8U5CaT5O_f5JB_PPu_sHww5nU8gaEXvHpwTLFT34T8ZobmaZD1WnFV836-eE238PNWUPELWCD4560Dz56sNlxRZg2BWAYLtrlKwoGBsgBGT_ TSgYW9s2nfMW1_bAjuCgG80uBg5ZBYO-1snK7YxhS9oVERUXksZElSV09upyggQOWrKAxG__jEccejgc1j3muV4m5NNv_Z59qFgzuTBUKJg7aE7ZK5vrydvb gzEaL-X49H1lWyfPy5-HmsOVfRFafQIehvxBvMRQlXkJGIeRn2EVeQhjJx8sqe_PJw-GUe6ADPiC68KO6qPjVAfJZs5BMWjuSa8N_CN9Uokt7dZlgPHL5lG7 ZCkeolQ5LKiWsphFHxsLjGooDREMOvWxlfPY8Q3Q4W9rQ-5QcGT7JQJBIxbZy_PGctJkCdwbU"."refresh_token": "def502007daab048cb4ff8bb3dc896fa1524587d23782f5a79593f82c2483f1e80bbaa3b0afcce9c2aff190c4614eaef08de601eddd429a94ae4169 194cbf9e89a6680cee74f87343a9b20e96d7c2d149f7cf0fd518043554a3115aeceef957723c3143ca371f40734ed2a178a5b7958f39f3e16d4c0262 8bfb2ef425f123d8afec5ebd34226b2bd9553b20cb8213b82ae382351eef3a5c372a273905791b5b9b348b8f8a2630408b9d000f6721a56c350d87b3 2ebb582fc7efdbc72a6f1e4a85c2d8ff8c29bd06d6f5b635f48d1614b7c1caf65f04071261a9db20e1310f2844935f32f605218beab57542c18e5906 a1afe57c43f1061274abb807bc29664239628e949d8d3b35da7dba7cba042ecc92b968b7614cf2d76496c8df1951d7899d9fb7fc6eab51354ed7e3bb 725da7e5c537e28c95218b4d32daf4412acdc57b70cf07ba1ce2008804bd5c7b5ae8cefb94a79f153cb5113c3408584bfd72eba16f73d19ded9113d5 2061e9869cb4a23cb31cf6de41511e510e9dc40f1a1c82db0918ff661f05ca47dc031e16f34ee483af9e808fe755c4095d19be3cab2ab62b4"
}
Copy the code
  • Send the request.
    • Users who have not logged in cannot view published content.
    • If the request does not contain a token, the homepage of the website will reject the access.
    • With the token you just obtained, you can access the website content normally.
curl --location --request GET 'http://d890.com' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjE5MzdmMWM1YTU2OWJkZDIxZmJhMDJlYjhiOWQyYTFlMWY5ZGEzNzEwOGFmNTQ4YzNjYTg1ZDY5 YjVkNGJlMmI0NGIzYzZjMTdlNGM0Mzk5In0.eyJhdWQiOiI5M2Q4OTY1Yi1kOGRmLTRlZjAtYjg4Ny05N2E2NzVmOTY4ZjEiLCJqdGkiOiIxOTM3ZjFjNWE1 NjliZGQyMWZiYTAyZWI4YjlkMmExZTFmOWRhMzcxMDhhZjU0OGMzY2E4NWQ2OWI1ZDRiZTJiNDRiM2M2YzE3ZTRjNDM5OSIsImlhdCI6MTU5MjA5NDUzMiwi bmJmIjoxNTkyMDk0NTMyLCJleHAiOjE1OTI5NjQ1MzEsInN1YiI6IjUiLCJzY29wZXMiOlsib2F1dGhhcGkiLCJhdXRoZW50aWNhdGVkIl19.J29rBtkl4pw de6b3Xf3bYiyv_w2pwMEQdtDI1YztqNZFm-rTvLFu_MkV3CDsfOi9YHp13d1RhMlz7JbYXylTlaPET9U6IjAI1SeEFV_ZqKxHC1z9LTXR-bxgzGToi7QqoVK a6ZiFPJgGdfhFsPxi6KD-zK1RUPmW5ueGpHM6U9JMPuh-ZL-mO69If36HJOhBR5eld0VDX_SMBq_4a-WJSOQmrzFxICo6Tqh34xLmNeSk3eiCE5hUij_MjcF HJ3jWnCNRh-8U5CaT5O_f5JB_PPu_sHww5nU8gaEXvHpwTLFT34T8ZobmaZD1WnFV836-eE238PNWUPELWCD4560Dz56sNlxRZg2BWAYLtrlKwoGBsgBGT_T SgYW9s2nfMW1_bAjuCgG80uBg5ZBYO-1snK7YxhS9oVERUXksZElSV09upyggQOWrKAxG__jEccejgc1j3muV4m5NNv_Z59qFgzuTBUKJg7aE7ZK5vrydvbg zEaL-X49H1lWyfPy5-HmsOVfRFafQIehvxBvMRQlXkJGIeRn2EVeQhjJx8sqe_PJw-GUe6ADPiC68KO6qPjVAfJZs5BMWjuSa8N_CN9Uokt7dZlgPHL5lG7Z CkeolQ5LKiWsphFHxsLjGooDREMOvWxlfPY8Q3Q4W9rQ-5QcGT7JQJBIxbZy_PGctJkCdwbU'
Copy the code

Create the API using the JsonAPI module.

Install the jsonapi extension module

composer require drupal/jsonapi_extras
Copy the code

To enable the module

drush en -y jsonapi jsonapi_extras
Copy the code

Set the jsonapi

JSON: THE API is a zero-configuration module that provides access to all Drupal entities for ready-to-use reading. However, you should consider not only reading data, but also the possibility of creating or updating it. Enabled, you need to go to the module Settings page (/ admin/config/services/jsonapi), and will “allow the operation of the” field changed to “accept all JSON: apis to create, read, update, and delete operations” value.

Save the configuration.

Custom API

Also, for security reasons, you must customize the API, which you can do using the JSON: API Extras module. This module is already installed with Composer and should be enabled on the “Extensions” page (/admin/modules).

Go to the Settings page (/ admin/config/services/jsonapi/extras), “the integrated query are included in the count” option is selected, then our API “path prefix” from * / jsonapi changed to/API/json *.

Later, you can also disable additional resources that are not available through the API on the Resource Substitution TAB of the Settings page.

Please remember to clear the Drupal caching (/ admin/config/development/performance) to apply the routing change.

Interface testing with Postman

Get the token first. You must carry a token to successfully request data.

  • Create your first article
curl --location --request POST 'http://d890.com/api/json/node/article' \
--header 'Accept: application/vnd.api+json' \
--header 'Content-Type: application/vnd.api+json' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjE5MzdmMWM1YTU2OWJkZDIxZmJhMDJlYjhiOWQyYTFlMWY5ZGEzNzEwOGFmNTQ4YzNjYTg1ZDY5 YjVkNGJlMmI0NGIzYzZjMTdlNGM0Mzk5In0.eyJhdWQiOiI5M2Q4OTY1Yi1kOGRmLTRlZjAtYjg4Ny05N2E2NzVmOTY4ZjEiLCJqdGkiOiIxOTM3ZjFjNWE1 NjliZGQyMWZiYTAyZWI4YjlkMmExZTFmOWRhMzcxMDhhZjU0OGMzY2E4NWQ2OWI1ZDRiZTJiNDRiM2M2YzE3ZTRjNDM5OSIsImlhdCI6MTU5MjA5NDUzMiwi bmJmIjoxNTkyMDk0NTMyLCJleHAiOjE1OTI5NjQ1MzEsInN1YiI6IjUiLCJzY29wZXMiOlsib2F1dGhhcGkiLCJhdXRoZW50aWNhdGVkIl19.J29rBtkl4pw de6b3Xf3bYiyv_w2pwMEQdtDI1YztqNZFm-rTvLFu_MkV3CDsfOi9YHp13d1RhMlz7JbYXylTlaPET9U6IjAI1SeEFV_ZqKxHC1z9LTXR-bxgzGToi7QqoVK a6ZiFPJgGdfhFsPxi6KD-zK1RUPmW5ueGpHM6U9JMPuh-ZL-mO69If36HJOhBR5eld0VDX_SMBq_4a-WJSOQmrzFxICo6Tqh34xLmNeSk3eiCE5hUij_MjcF HJ3jWnCNRh-8U5CaT5O_f5JB_PPu_sHww5nU8gaEXvHpwTLFT34T8ZobmaZD1WnFV836-eE238PNWUPELWCD4560Dz56sNlxRZg2BWAYLtrlKwoGBsgBGT_T SgYW9s2nfMW1_bAjuCgG80uBg5ZBYO-1snK7YxhS9oVERUXksZElSV09upyggQOWrKAxG__jEccejgc1j3muV4m5NNv_Z59qFgzuTBUKJg7aE7ZK5vrydvbg zEaL-X49H1lWyfPy5-HmsOVfRFafQIehvxBvMRQlXkJGIeRn2EVeQhjJx8sqe_PJw-GUe6ADPiC68KO6qPjVAfJZs5BMWjuSa8N_CN9Uokt7dZlgPHL5lG7Z CkeolQ5LKiWsphFHxsLjGooDREMOvWxlfPY8Q3Q4W9rQ-5QcGT7JQJBIxbZy_PGctJkCdwbU' \
--data-raw '{" data ": {" type" : "node - article", "attributes" : {" title ":" my first article, "" body" : {" value ": "This is the first article I created using the jsonapi ", "format": "plain_text"}}}}'
Copy the code

Refresh the homepage to see our new articles.

  • Get the list of articles
curl --location --request GET 'http://d890.com/api/json/node/article' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjE5MzdmMWM1YTU2OWJkZDIxZmJhMDJlYjhiOWQyYTFlMWY5ZGEzNzEwOGFmNTQ4YzNjYTg1ZDY5 YjVkNGJlMmI0NGIzYzZjMTdlNGM0Mzk5In0.eyJhdWQiOiI5M2Q4OTY1Yi1kOGRmLTRlZjAtYjg4Ny05N2E2NzVmOTY4ZjEiLCJqdGkiOiIxOTM3ZjFjNWE1 NjliZGQyMWZiYTAyZWI4YjlkMmExZTFmOWRhMzcxMDhhZjU0OGMzY2E4NWQ2OWI1ZDRiZTJiNDRiM2M2YzE3ZTRjNDM5OSIsImlhdCI6MTU5MjA5NDUzMiwi bmJmIjoxNTkyMDk0NTMyLCJleHAiOjE1OTI5NjQ1MzEsInN1YiI6IjUiLCJzY29wZXMiOlsib2F1dGhhcGkiLCJhdXRoZW50aWNhdGVkIl19.J29rBtkl4pw de6b3Xf3bYiyv_w2pwMEQdtDI1YztqNZFm-rTvLFu_MkV3CDsfOi9YHp13d1RhMlz7JbYXylTlaPET9U6IjAI1SeEFV_ZqKxHC1z9LTXR-bxgzGToi7QqoVK a6ZiFPJgGdfhFsPxi6KD-zK1RUPmW5ueGpHM6U9JMPuh-ZL-mO69If36HJOhBR5eld0VDX_SMBq_4a-WJSOQmrzFxICo6Tqh34xLmNeSk3eiCE5hUij_MjcF HJ3jWnCNRh-8U5CaT5O_f5JB_PPu_sHww5nU8gaEXvHpwTLFT34T8ZobmaZD1WnFV836-eE238PNWUPELWCD4560Dz56sNlxRZg2BWAYLtrlKwoGBsgBGT_T SgYW9s2nfMW1_bAjuCgG80uBg5ZBYO-1snK7YxhS9oVERUXksZElSV09upyggQOWrKAxG__jEccejgc1j3muV4m5NNv_Z59qFgzuTBUKJg7aE7ZK5vrydvbg zEaL-X49H1lWyfPy5-HmsOVfRFafQIehvxBvMRQlXkJGIeRn2EVeQhjJx8sqe_PJw-GUe6ADPiC68KO6qPjVAfJZs5BMWjuSa8N_CN9Uokt7dZlgPHL5lG7Z CkeolQ5LKiWsphFHxsLjGooDREMOvWxlfPY8Q3Q4W9rQ-5QcGT7JQJBIxbZy_PGctJkCdwbU'
Copy the code

  • Get the specified article
curl --location --request GET 'http://d890.com/api/json/node/article/0de2ce4b-1f3b-4147-8315-6f15d0314b00' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjE5MzdmMWM1YTU2OWJkZDIxZmJhMDJlYjhiOWQyYTFlMWY5ZGEzNzEwOGFmNTQ4YzNjYTg1ZDY5 YjVkNGJlMmI0NGIzYzZjMTdlNGM0Mzk5In0.eyJhdWQiOiI5M2Q4OTY1Yi1kOGRmLTRlZjAtYjg4Ny05N2E2NzVmOTY4ZjEiLCJqdGkiOiIxOTM3ZjFjNWE1 NjliZGQyMWZiYTAyZWI4YjlkMmExZTFmOWRhMzcxMDhhZjU0OGMzY2E4NWQ2OWI1ZDRiZTJiNDRiM2M2YzE3ZTRjNDM5OSIsImlhdCI6MTU5MjA5NDUzMiwi bmJmIjoxNTkyMDk0NTMyLCJleHAiOjE1OTI5NjQ1MzEsInN1YiI6IjUiLCJzY29wZXMiOlsib2F1dGhhcGkiLCJhdXRoZW50aWNhdGVkIl19.J29rBtkl4pw de6b3Xf3bYiyv_w2pwMEQdtDI1YztqNZFm-rTvLFu_MkV3CDsfOi9YHp13d1RhMlz7JbYXylTlaPET9U6IjAI1SeEFV_ZqKxHC1z9LTXR-bxgzGToi7QqoVK a6ZiFPJgGdfhFsPxi6KD-zK1RUPmW5ueGpHM6U9JMPuh-ZL-mO69If36HJOhBR5eld0VDX_SMBq_4a-WJSOQmrzFxICo6Tqh34xLmNeSk3eiCE5hUij_MjcF HJ3jWnCNRh-8U5CaT5O_f5JB_PPu_sHww5nU8gaEXvHpwTLFT34T8ZobmaZD1WnFV836-eE238PNWUPELWCD4560Dz56sNlxRZg2BWAYLtrlKwoGBsgBGT_T SgYW9s2nfMW1_bAjuCgG80uBg5ZBYO-1snK7YxhS9oVERUXksZElSV09upyggQOWrKAxG__jEccejgc1j3muV4m5NNv_Z59qFgzuTBUKJg7aE7ZK5vrydvbg zEaL-X49H1lWyfPy5-HmsOVfRFafQIehvxBvMRQlXkJGIeRn2EVeQhjJx8sqe_PJw-GUe6ADPiC68KO6qPjVAfJZs5BMWjuSa8N_CN9Uokt7dZlgPHL5lG7Z CkeolQ5LKiWsphFHxsLjGooDREMOvWxlfPY8Q3Q4W9rQ-5QcGT7JQJBIxbZy_PGctJkCdwbU'
Copy the code

  • Modify the content of the article
curl --location --request PATCH 'http://d890.com/api/json/node/article/1bbfa4af-c902-4253-8b4f-fdfb7b4e6d1f' \
--header 'Accept: application/vnd.api+json' \
--header 'Content-Type: application/vnd.api+json' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjE5MzdmMWM1YTU2OWJkZDIxZmJhMDJlYjhiOWQyYTFlMWY5ZGEzNzEwOGFmNTQ4YzNjYTg1ZDY5 YjVkNGJlMmI0NGIzYzZjMTdlNGM0Mzk5In0.eyJhdWQiOiI5M2Q4OTY1Yi1kOGRmLTRlZjAtYjg4Ny05N2E2NzVmOTY4ZjEiLCJqdGkiOiIxOTM3ZjFjNWE1 NjliZGQyMWZiYTAyZWI4YjlkMmExZTFmOWRhMzcxMDhhZjU0OGMzY2E4NWQ2OWI1ZDRiZTJiNDRiM2M2YzE3ZTRjNDM5OSIsImlhdCI6MTU5MjA5NDUzMiwi bmJmIjoxNTkyMDk0NTMyLCJleHAiOjE1OTI5NjQ1MzEsInN1YiI6IjUiLCJzY29wZXMiOlsib2F1dGhhcGkiLCJhdXRoZW50aWNhdGVkIl19.J29rBtkl4pw de6b3Xf3bYiyv_w2pwMEQdtDI1YztqNZFm-rTvLFu_MkV3CDsfOi9YHp13d1RhMlz7JbYXylTlaPET9U6IjAI1SeEFV_ZqKxHC1z9LTXR-bxgzGToi7QqoVK a6ZiFPJgGdfhFsPxi6KD-zK1RUPmW5ueGpHM6U9JMPuh-ZL-mO69If36HJOhBR5eld0VDX_SMBq_4a-WJSOQmrzFxICo6Tqh34xLmNeSk3eiCE5hUij_MjcF HJ3jWnCNRh-8U5CaT5O_f5JB_PPu_sHww5nU8gaEXvHpwTLFT34T8ZobmaZD1WnFV836-eE238PNWUPELWCD4560Dz56sNlxRZg2BWAYLtrlKwoGBsgBGT_T SgYW9s2nfMW1_bAjuCgG80uBg5ZBYO-1snK7YxhS9oVERUXksZElSV09upyggQOWrKAxG__jEccejgc1j3muV4m5NNv_Z59qFgzuTBUKJg7aE7ZK5vrydvbg zEaL-X49H1lWyfPy5-HmsOVfRFafQIehvxBvMRQlXkJGIeRn2EVeQhjJx8sqe_PJw-GUe6ADPiC68KO6qPjVAfJZs5BMWjuSa8N_CN9Uokt7dZlgPHL5lG7Z CkeolQ5LKiWsphFHxsLjGooDREMOvWxlfPY8Q3Q4W9rQ-5QcGT7JQJBIxbZy_PGctJkCdwbU' \
--data-raw '{ "data": { "type": "node--article", "id": "1bbfa4af-c902-4253-8b4f-fdfb7b4e6d1f", "attributes": { "title": "Revise my first article"}}}'

Copy the code

Refresh the homepage of the website to see the articles we have modified successfully.

  • Delete an article
curl --location --request DELETE 'http://d890.com/api/json/node/article/1bbfa4af-c902-4253-8b4f-fdfb7b4e6d1f' \
--header 'Content-Type: application/vnd.api+json' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjE5MzdmMWM1YTU2OWJkZDIxZmJhMDJlYjhiOWQyYTFlMWY5ZGEzNzEwOGFmNTQ4YzNjYTg1ZDY5 YjVkNGJlMmI0NGIzYzZjMTdlNGM0Mzk5In0.eyJhdWQiOiI5M2Q4OTY1Yi1kOGRmLTRlZjAtYjg4Ny05N2E2NzVmOTY4ZjEiLCJqdGkiOiIxOTM3ZjFjNWE1 NjliZGQyMWZiYTAyZWI4YjlkMmExZTFmOWRhMzcxMDhhZjU0OGMzY2E4NWQ2OWI1ZDRiZTJiNDRiM2M2YzE3ZTRjNDM5OSIsImlhdCI6MTU5MjA5NDUzMiwi bmJmIjoxNTkyMDk0NTMyLCJleHAiOjE1OTI5NjQ1MzEsInN1YiI6IjUiLCJzY29wZXMiOlsib2F1dGhhcGkiLCJhdXRoZW50aWNhdGVkIl19.J29rBtkl4pw de6b3Xf3bYiyv_w2pwMEQdtDI1YztqNZFm-rTvLFu_MkV3CDsfOi9YHp13d1RhMlz7JbYXylTlaPET9U6IjAI1SeEFV_ZqKxHC1z9LTXR-bxgzGToi7QqoVK a6ZiFPJgGdfhFsPxi6KD-zK1RUPmW5ueGpHM6U9JMPuh-ZL-mO69If36HJOhBR5eld0VDX_SMBq_4a-WJSOQmrzFxICo6Tqh34xLmNeSk3eiCE5hUij_MjcF HJ3jWnCNRh-8U5CaT5O_f5JB_PPu_sHww5nU8gaEXvHpwTLFT34T8ZobmaZD1WnFV836-eE238PNWUPELWCD4560Dz56sNlxRZg2BWAYLtrlKwoGBsgBGT_T SgYW9s2nfMW1_bAjuCgG80uBg5ZBYO-1snK7YxhS9oVERUXksZElSV09upyggQOWrKAxG__jEccejgc1j3muV4m5NNv_Z59qFgzuTBUKJg7aE7ZK5vrydvbg zEaL-X49H1lWyfPy5-HmsOVfRFafQIehvxBvMRQlXkJGIeRn2EVeQhjJx8sqe_PJw-GUe6ADPiC68KO6qPjVAfJZs5BMWjuSa8N_CN9Uokt7dZlgPHL5lG7Z CkeolQ5LKiWsphFHxsLjGooDREMOvWxlfPY8Q3Q4W9rQ-5QcGT7JQJBIxbZy_PGctJkCdwbU' \
--data-raw ' '
Copy the code

Go back to the home page to refresh and see that our newly added article has been deleted.

For further use of the jsonapi, including filtering, association, and filtering, see the official documentation.

References:

  • (Goldman Sachs
  • How to quickly configure Drupal as a decoupled API-first system