=============================
MAS INFORMACION de WEBSERVICES
============================
https://www.drupal.org/node/783254
LISTA DE RECURSOS: /admin/structure/services/list/masterws/resources
( PARA SOPORTE DE ENTITY REQUIERE EL MODULO ECK_SERVICES)
Controllers
Tabulation of the controller mapping for the REST server. Requests gets mapped to different controllers based on the HTTP method used and the number of parts in the path.
Count refers to the number of path parts that come after the path to identify the resource type. The request for `/services/rest/node/123` would have the count of 1, as `/services/rest/node` identifies the resource type, followed by the nid identifying the desired resource.
C,R,U,D,I = Create, Read, Update, Delete (CRUD) and Index requests
A = Action
T = Targeted action
X = Relationship request
COUNT |0|1|2|3|4|N|
-------------------
GET |I|R|X|X|X|X|
-------------------
POST |C|A|T|T|T|T|
-------------------
PUT | |U| | | | |
-------------------
DELETE| |D| | | | |
-------------------
CRUD
The basis of the REST server. In the below:
[endpoint_path] refers to the Path to the endpoint you defined when setting up the endpoint.
[resource] is the name of the resource, like node or taxonomy_term. (VER: /admin/structure/services/list/[endpoint]/resources )
[resource_id] is the id of the resource you're actingon.
Create: POST /[endpoint_path]/[resource] + body data
Retrieve: GET /[endpoint_path]/[resource]/[resource_id]
Update: PUT /[endpoint_path]/[resource]/[resource_id] + body data
Delete: DELETE /[endpoint_path]/[resource]/[resource_id]
And last but least, the little bastard sibling to Retrieve that didn't get its place in the acronym:
Index: GET /[endpoint_path]/[resource]
For example, to fetch a taxonomy term, you could use:
GET: /my_endpoint/taxonomy_term/5
Where 5 is the tid of the term to fetch.
If you wanted that term's data in json format, you'd use:
GET: /my_endpoint/taxonomy_term/5.json
In the REST server the index often doubles as a search function. The comment resource allows queries like the following for checking for new comments on a node (where 123456 is the timestamp for the last check and 123600 is now):
New comments: GET /services/comment?
123¶meters[timestamp]=123456:
Actions
Actions are performed directly on the resource type, not a individual resource. The following example is hypothetical (but plausible). Say that you want to expose a API for the [apachesolr][apachesolr] module. One of the things that could be exposed is the functionality to reindex the whole site.
Reindex: POST /services/rest/apachesolr/reindex
Targeted actions
Targeted actions acts on a individual resource. A good, but again - hypothetical, example would be the publishing and unpublishing of nodes.
Publish: POST /my_endpoint/node/123/publish
Relationships
Relationship requests are convenience methods (sugar) to get something that's related to an individual resource. A real example would be the relationship that the [comment_resource][comment_resource] module adds to the node resource:
Get comments: GET /my_endpoint/node/123/comments
This more or less duplicates the functionality of the comment index:
Get comments: GET /my_endpoint/comments?nid=123
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CON OPCION UUID INSTALADA: ( PARA SOPORTE DE ENTITY REQUIERE EL MODULO ECK_SERVICES)
#dsm(getws("master","http://master.agxproducts.com/masterws/user/177354.json"));
$user=drupal_json_decode(getws("master","http://master.agxproducts.com/masterws/user/8f78098f-2b0e-4eca-b5b0-6c96..."));
#dsm(getws("master","http://master.agxproducts.com/masterws/user/145.json"));
# dsm(webs("sima","GET","user/1"));
dsm(postws("sima","simaform",(array("title" => "TESTT TITLE 44","type"=>"exs_stest","field_datos[und][0][value]"=>"vjhvjvjhvjvjhhrrrrrrrR")))); ##OKK
# dsm(getws("sima","simaform/2?fields=field_datos"));
}
# dsm(webs("sima","POST","node",array("node" =>array("title"=>"ghjjjjvhj","body"=>"lkjnkllk",'type']=>'examen'))));
dsm(webs("master","PUT","entity/node?_format=hal_json",array("title"=>"ARIEL TUI","body"=>"lttytt kjnkllk",'type'=>'examen')));
dsm(webs("master","POST", "node", array( "data"=>array("title" => "TESTT TITLE 44","type"=>"examen","field_datos[und][0][value]"=>"vjhvjvjhvjvjhhrrrrrrrR"))));
dsm(postws("master", "node" ,array( "data"=>array("title" => "TESTT TITLE 44","type"=>"examen","field_datos[und][0][value]"=>"vjhvjvjhvjvjhhrrrrrrrR"))));
dsm(webs("master","POST", "node" ,array("node" =>array("title"=>"ghjjjjvhj","body"=>"lkjnkllk",'type'=>'examen'))));
dsm(postws("master", "simaform" ,(array("title" => "TESTT TITLE 44","type"=>"exs_stest","field_datos[und][0][value]"=>"vjhvjvjhvjvjhhrrrrrrrR")))); ##OKK
FUNCIONES CREADAS EN ESTE MODULO WEBSERVICES
Las funciones manejan el login, user, pass, retry, session, cookies, etc a los servidores conocidos.
getws/postws/putws/("nombre corto de las credenciales almacenadas (sima,master, stest...) a utilizar servidor o url" ,"uri o direccion relativa o absoluta", "array de datos a enviar en post o put")
getws("sima","node/1.json") = get sima.agxproducts.com/user/1.json
EJEMPLOS FUNCIONAL:
1- USUARIOS
==============
Cfear Usuario
-------------
$s=array();
$s['name'] = "cc422";
$s['field_apellidos']['und'][0]['value'] = "TUIA";
$s['nombres']['und'][0]['value'] = "ARRI";
$s['simauser']['und'][0]['value'] = "";
$s['fecha de nacimiento']['und'][0]['value'] = "1970-02-03";
$s['rh']['und'][0]['value'] = "A POSITIVO";
$s['ciudad nacimiento']['und'][0]['value'] = "";
$s['field_fecha_exp_doc']['und'][0]['value'] = "1980-06-06";
$s['pass']="tesrrrrrr";
$s['mail']="tesrr@elyte.co";
$s['rh']['und'][0]['value'] = "A POSITIVO";
$s['field_simaexamdata']['und'][0]['value']='{
"Id": "CC521099",
// "PriApe": "TORRES",
// "SegApe": "TORRES",
// "Nombre": "DEISY MARIA",
// "FecNac":"1988-12-28",
// "Direccion": "CL 3 NO 14 10",
// "Mail": "",
"Telefono": "3134588",
"Celular": "313458854",
// "Sexo": "F",
"Rh": "O POSITIVO",
// "COD_DEPA_NAC": "13",
// "COD_CIU_NAC": "13052",
// "COD_DEPA_EXP": "13",
"COD_CIU_EXP": "13052",
"FECHA_EXP_DOC": "1991-03-27",
"COD_ESCOLARIDAD": "4"}';
dsm(postws("master","user/register",$s)); // Retorna array con el uid y uuid del usuario.
# VER INFO (ej:UUID)
------------
get "endpoint/user/147
FILTRO EN LA URL
==================
CUALQUIER SOLICITUD PUEDE SER FILTRADA
/masterws/user/1/groups.json?parameters[created]=1569643077¶meters[....]=
Si etsa con UUID hay varias formas de buscar usuarios incluyendo par+ámetros:
1.- [endpoint]/user/[UUID] = /masterws/user.json?parameters[uuid]=d8482771-66a7-4798-8508-44a0e9f321b4
2.- [endpoint]/entity_user/[uid] = /asterws/user.json?parameters[uid]=160
EN SIMA MASTER: EMPRESAS
https://master.agxproducts.com/masterws/entity_taxonomy_term/1591/nodes_...
SUCURSALES
https://master.agxproducts.com/masterws/entity_taxonomy_term/1592/nodes_...
para TRABAJAR SOLO CON UUID HABILITAR SOLO EL MODULO UUID /ENDPOINT/NODE/UUID.JSON
// solicitar el UUID y otros: url=[endpoint]/user/[id del usuario]
# Modificar info
-----------------
$s=array();
$s['name'] = "cc443322"; // Vr del campo a modificar
dsm(putws("master","user/147", $s); //
SI Eta habilitadoo el modulo UUID SERVICES : el url debe ser /endpoint/user/[UUID] Y Si se tiene el nid sería /endpoint/entity_user/[uid]
Busqueda con parametros:
------------------------
https://master.agxproducts.com/masterws/user.json?parameters[name]=TI020...
2- ADICIONAR A GRUPO
$s=drupal_json_decode('{
"type": "user",
"etid": "152", // Entity ID= uid = id del usuario
"entity_type": "user",
"gid": "5", // NID del grupo = nid de organizacion
"group_type": "node",
"state": "1",
"roles":{"3":"administrator member"},
"field_foo":{"und":[{"value":"123"}]}
}');
dsm(postws("master","og/join.json,$s)); // Retorna [true]. =[MY-ENDPOINT]/og/join/[GROUP-NID]/[USER-UID]
|
Ver grupos de un usuario https://master.agxproducts.com/masterws/user/1/groups.json
2-CREAR EXAMEN:
$s=(drupal_json_decode('{"type":"examen","title":"Cruz Roja de Hondur","log":"","status":"1","comment":"0","promote":"1","sticky":"0"}'));
$s['field_ciudad_r']['und'][0]['target_id']="Tegucigalpa/Distrito Central, Francisco Morazán (801)"; // Ver abajo para obtener listado
$s['field_evaluado']['und'][0]['target_id']="cc456"; // debe existir
$s['field_simaexamdata']['und'][0]['value']='{
"Id": "CC52101294",
// "PriApe": "T"13052",
// "COD_DEPA_EXP": "13",
"COD_CIU_EXP": "13052",
"FECHA_EXP_DOC": "1991-03-27",
"COD_ESCOLARIDAD": "4",
"Ciudad": "BOGOTA - CUNDINAMARCA",
"UsuarioRecepcion": "Nombre de Usuario en Sima o UID",
"Fecha": "2013-05-25",
A }';
NODOS/USERS con UUID:
---------------------
dsm(postws("master","node.json",$s)); //// POST A URL = http://master.agxproducts.com/[endpoint]/node.json
SI Eta habilitadoo el modulo UUID SERVICES : el url debe ser /endpoint/node/[UUID] Y Si se tiene el nid sería /endpoint/entity_node/[nid]
Para users /endpoint/user/[UUID] Y Si se tiene el uid /endpoint/entity_user/[uid]
EJEMPLOS DE CONSULTA DE TAXONOMIA: ver mas comandos en https://master.agxproducts.com/admin/structure/services/list/masterws/re...
dsm(getws("master","entity_taxonomy_term/")); // VER LISTA DE TERMINOS Ver Termino 5: [endpoint]/entity_taxonomy_term/5
dsm(getws("master","entity_taxonomy_vocabulary"));
EJEMLO MODIFICANDO NODO EN SIMAMASTER CON UUID: (MODULO SERVICES UUID HABILITADO)
>>>>>>>>>>>
$a=drupal_json_decode('{"title": "TI1217199500301","type":"evaluado","field_nombr":{"und": [{"value": "EMILSON ARMANDO " }]},"field_apelli":{"und": [{"value": "VASQUEZ RUIZ " }]},"field_simaevadata":{"und":[{"value":"{\"Id\":\"TI1217199500301\",\"Nombre\":\"EMILSON ARMANDO \",\"PriApe\":\"VASQUEZ \",\"SegApe\":\"RUIZ \",\"FecNac\":\"10/11/1995\",\"Direccion\":\"Aldea Las Crucitas\",\"Mail\":\"\",\"Telefono\":\"\",\"Celular\":\"99253716\",\"Sexo\":\"M\",\"Rh\":\"O+\",\"COD_DEPA_NAC\": \"12\",\"COD_CIU_NAC\":\"1217\",\"COD_DEPA_EXP\": \"\",\"COD_CIU_EXP\":\"\",\"FecExpDoc\":\"09/09/2020\",\"COD_ESCOLARIDAD\":\"2\",\"Ciudad\":\"La Paz \",\"UsuarioRecepcion\":\"Recepcion3\",\"Fecha\":\"21/04/2021\",\"Foto\":\"\",\"Firma\":\"\",\"HullaI\":\"\",\"HullaD\":\"\"}"}]}}') ;
dpm(putws('master', 'http://master.agxproducts.com/masterws/node/f17c2217-9c90-465f-8daf-d52c...',$a));
<<<<<<<<<<
GRUPOS:
---------
https://git.drupalcode.org/project/og_services/blob/HEAD/README.md
type: When using POST, this is the id for the og_membership_type, defaults to 1. Otherwise it will be equal to the machine name of the membership type.
etid: The target entity id, usually a uid.
entity_type: The target entity type, usually user.
gid: The group entity id, usually a nid.
group_type: The group entity type, usually node.
state: 1 for active, 2 for pending, 3 for blocked
roles: If entity_type is user, this refers to the roles on the membership. It can only be set when state is equal to 1.
Cr
* /
$user_data1 = array(
'name' => 'test123456',
'mail' => 'test@gmail.com',
'pass' => 'test',
'status' => 1,
);
$user_data['field_user_display_name']['und'][0]['value']="ARIEL DE JESUS";
# 'Display Name' => 'Test01',
$user_data['uuid']='f1c52d6e-8640-45da-a57d-989557f6b616';
//OKOK
dsm(putws("master","user/f1c52d6e-8640-45da-a57d-989557f6b616.json")); /////////////>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<
#dsm(postws("master","user/register.json",$user_data)); /////////////////////////<<<<<<<<<<<<<<<<<<<<<<<<<<<
dsm($user);
$fields=array_keys($user);
#print_r("<pre>");print_r($fields);print_r("</pre>");
Array
(
[0] => uid
[1] => name
[2] => pass
[3] => mail
[4] => theme
[5] => signature
[6] => signature_format
[7] => created
[8] => access
[9] => login
[10] => status
[11] => timezone
[12] => language
[13] => picture
[14] => init
[15] => data
[16] => uuid
[17] => roles
[18] => og_user_node
[19] => field_user_about
[20] => field_user_picture
[21] => field_user_display_name
[22] => field_simauserdata
[23] => realname
[24] => url_alias
);
SUBIR IMAGENES O ARCHIVOS
===========================
VER http://tylerfrankenstein.com/code/drupal-services-file-create-example-js...
EJEMPLO
$img="R0lGODlhgALwAHAAACwAAAAAgALwAIcAAAAAADMAAGYAAJkAAMwAAP8AKwAAKzMAK2YAK5kAK8wAK/8AVQAAVTMAVWYAVZkAVcwAVf8AgAAAgDMAgGYAgJkAgMwAgP8AqgAAqjMAqmYAqpkAqswAqv8A1QAA1TMA1WYA1ZkA1cwA1f8A/wAA/zMA/2YA/5kA/8wA//8zAAAzADMzAG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llGXCX5LcZcnIZM9VywmaISNDTIHEsiHd0+UtF+LIa9IEmahMDAMnWY+ftbNnPWOnzeJJD3lCA4LuI1w83ekzZQiQElS02BylEgBtQgqJ/LSZzhSaUIYqY6E6q8fyIALKmf+ksHL7fCdGl6FGgazQJ638DgpVkgN6KmOe8rxZSU9q0pSidBkqVUY2aTlJcSoEnCPD0EAFsEmTkLMg+voaUAMqVKIG9ZwEcYo1fzrUhzW1XwKTEl4kChGnFpWpVwXqUQXSzJNwkyBVzSrYxFpUraoQOkplG3S8alSsstWqXBvYTBlU05pRk3YD3aVOclkxHgaRryMJQGKm+leBjHJWhLUIGiHjVYEoNjGZQKxFCqpIldjyluqcK8kihZfIHgafne1gYorIrMlyErRIFWkOlePTvw6Qf+LEoUogmVNAOfO0OH3jaQG0sttKxCm9LZBa6ShH4PLUi3RFiBiBeRRP4ilFPcAFHlIYS6rP8PQkmO1sYAZbsdIGBq0dLc92+RqjEyKXteB1ZllV51GGQLcgeEnhnwIwAPn0lqI0mW6qrCsUkBbEsfu7/61lu1g25O5jr5ltXi+9eZJngtYqfkNsAAT8vN7ud8CdvW9ivmvW8vQ2lLit6XkFMNvc1lZI6oUWV1siRGhVRcXHQfGdCAqZOmX3bMOtTIyzFID/UnYkfxTnTRGMF0roeKeGMfKOu5KY+CKIX92FzDEJO+PIcCTJBAosfjbMXqG058pYZm956SpiLgtGxw8enhUrxq8e80i+AfXjsPCzDBnAVcZgk4EHk5IDOyv5MxOG4npEJOUvg+ZhC9YIa1ID5dstQ9GoYTRNvPxo1awSv46hdKY1zRqBXI0249t0qFUzkKq97HqaGMN8RL3q1AhgBp6+zzIACjZWh7qbpl5SGiA0XWakLGMSg6R1rTftajW0ucDHRnaylb1sZjfb2d8LCAA7";
$options = array(
"type"=>"post",
"data"=> array(
"uri"=>"public://my_image2.jpg",
"field_name"=>"field_foto",
"file"=>$img,
"filename"=>"my_image2.jpg",
"filepath"=>"public://my_image2.jpg",
),
"dataType"=>"json"
);
#$options['headers']['Content-Type']="multipart/form-data";
$url="https://master.agxproducts.com/masterws/entity_file/?_format=json";
$fil=postws("master",$url,$options);
dsm($fil);
*/
/****** access control to entity
//https://www.webomelette.com/custom-access-control-drupal-7-entities
//https://drupal.stackexchange.com/questions/53251/how-do-i-create-extra-p...
*/
/**************************INSTRUCCIONES USO DEL MODULO ts_WEBSERVICES*************************************
ESTE MODULO PUEDE UTILIZARSE PARA CUALQUIER SERVIDOR REST. REALIZA RUTINAS AUTIMATIZADAS:
1- REVUISA CONEXION Y DEPENDIENDO DE ERRORES RECIBIDOS , INTENTA CORRECCION COMO:
- login si no hay conexion o si usuario no autorizado
- intercambia a http si tienee error con https. Si tiene inicialmente http NO CAMBIA A Https, po lo tanto es mejor dejarlo siempre en HTTPS.
2. ALMACENA LA CONF DE LA ULTIMA CONEXION EXITOSA CON CADA SERVER
3. PARA UTILIZARLO CON CUALQUIER SERVIDOR O CAMBIAR CLAVES.
desde consola PHP :
getws(array(
srv => sima
url => https://sima.thesafer.com,
endp => simawebs,
name => adm,
pass => CLAVE
), node/123);
4. Varios comandos : getws(), putws() , postws(), login() o un solo comando webs(9
dsm(webs( 'ppac','PUT','node/319', array('title' => 'HGJK')));
5 debug : solo para perfil administrador Enciende debug adicionando a cualquier url ?debug=1
los paquetes de debug tienen un array por cada envio con 3 eklementos:
1. url enviada
2. paquete enviado
3. paquete respondido
EJEMPLO OK
dsm(webs("sima","GET","http://sima.asesoramos.net/simawebs/views/ver_s2/?display_id=usua&doc=cc...",array()));
11
'Index' in services module will list out an entity(node, users, taxonomy..) in descending Order of its created time, vid, name etc based on the arguments that are passed. The common arguments for the Index are
page
- Page number of results to return (in pages of 20).fields
- The fields you want returned.parameters
- An array containing fields and values used to build a sql WHERE clause indicating items to retrieve. (array)-
pagesize
- number of items to be returned. (Integer)In case of retrieve, it returns the complete entity object of the passed 'entity_id'
UPDATED:
Sample URLS for Index is
- http://domain/endpoint/node?fields=nid,vid¶meters[nid]=7¶meters[uid]=1&page=2
- http://domain/endpoint/taxonomy_term?fields=tid,name¶meters[tid]=7¶meters[vid]=1
- http://domain/endpoint/user?fields=uid,name,mail¶meters[uid]=1
- http://domain/endpoint/node?pagesize=3
For documentation you can see Services: An API for remote applications.