Skip to content

Instantly share code, notes, and snippets.

View e0ipso's full-sized avatar
🏠
Working from home

Mateu Aguiló Bosch e0ipso

🏠
Working from home
View GitHub Profile
@e0ipso
e0ipso / my-modules.js
Created December 19, 2024 11:22
Table of Drupal modules
// Function to fetch data from a URL
async function fetchData(url) {
try {
const response = await globalThis.fetch(url);
if (!response.ok) {
throw new Error(`Failed to fetch data: ${response.statusText}`);
}
const data = await response.json();
return data.list || [];
} catch (error) {
@e0ipso
e0ipso / contenta.gql
Last active October 12, 2018 12:59
Example schema with auto-resolvers from OpenAPI definitions
type Recipe {
id: String!
title: String!
author: User!
}
type User {
id: String!
name: String!
recipes: [Recipe]
}
@e0ipso
e0ipso / api-first-priorities.md
Last active October 13, 2017 15:14
API-First Priorities
@e0ipso
e0ipso / uuid-setter.php
Created March 11, 2017 10:44
Allow setting the UUID from the front-end
<?php
/**
* Implements hook_entity_property_info_alter().
*/
function mymodule_entity_property_info_alter(&$info) {
// Add the uuid setter if not present.
foreach (entity_get_info() as $entity_type => $entity_info) {
if (
!empty($entity_info['uuid'])

Status

This extension was developed as part of the jsonapi module for Drupal.

Introduction

The JSON API specification is agnostic about how a server implements filtering strategies. In fact, the spec says:

Note: JSON API is agnostic about the strategies supported by a server. The filter query parameter can be used as the basis for any number of filtering strategies.

Status

This extension was developed as part of the jsonapi module for Drupal.

Introduction

It is possible for a server to have mixed success and error responses when dealing with a single or multiple entities at once. For instance, when generating collections of resource entities there is a chance that the GET operation results in a partial success. That is because each entity can generate errors independently from the other. In such scenarios the server MAY respond to the request with a partial success response.

Servers and clients MUST negotiate support for and use of the Partial Success extension as described in the base specification using partialsuccess as the name of the extension.

@e0ipso
e0ipso / JSONAPI Authenticated
Created September 16, 2016 13:02
JSONAPI and RESTful Web Services performance comparison
====================================================================================================
AUTHENTICATED
====================================================================================================
>$ ab -v1 -k -c8 -n10 -A admin:admin http://d8dev.local/api/node/article/900b681b-581a-4624-9ff6-99cc865df429\?_format\=api_json\&include\=uid,uid.user_picture,field_tags
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking d8dev.local (be patient).....done
@e0ipso
e0ipso / environment-install.md
Last active September 12, 2016 07:31 — forked from alefi87/environment-install.md
OS X 10.10 Yosemite, Apache, PHP 5.6, MySQL, Memcache, SSL setup with Homebrew