Skip to content

Commit 79d90d3

Browse files
committed
docs: translation (#22)
* translation * landing page link in spanish
1 parent acae884 commit 79d90d3

File tree

3 files changed

+189
-15
lines changed

3 files changed

+189
-15
lines changed

docs/es/sync/README.md

Lines changed: 186 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,211 @@
1-
[![theeye.io](../../images/logo-theeye-theOeye-logo2.png)](https://theeye.io/index.html)
1+
[![theeye.io](../images/logo-theeye-theOeye-logo2.png)](https://theeye.io/en/index.html)
22

3-
# Sync API
3+
# API Sync
4+
5+
Ejecución sincrónica de tareas.
46

57
## URL
68

79
**https://sync.theeye.io**
810

11+
____
12+
13+
La ejecución de tareas individuales en TheEye es asincrónica por la naturaleza de los procesos.
14+
Esto se debe a que las tareas en general son ejecutadas en lotes mediante el uso de "Queues". El tiempo y la complejidad varía en cada implementación.
15+
Habitualmente no necesitamos esperar el resultado de forma instantanea.
16+
17+
En algunos casos es necesario obtener el resultado de la ejecución de forma inmediata.
18+
Este es aún común si necesitamos que las tareas se comporten como si fueran métodos de una API Rest.
19+
20+
Este comportamiento puede ser logrado utilizando la API en modo Sync.
21+
Cualquier tarea puede ser utilizada mediante la API Sync. Es necesario tener en cuenta que con tiempo de ejecución muy largos se pueden producir Timeouts o incluso el orquestador puede cortar la comunicación de forma repentina.
22+
23+
Un tiempo de respuesta razonable no debe superar los 60 segundos de ejecución
24+
25+
___
26+
27+
28+
## Rutas
29+
30+
| Method | Path | Description | ACL |
31+
| ---- | ----| ----| ----|
32+
| POST | /${customer}/task/${id}/job | [Run task](#waiting-output) | user |
33+
934

10-
La ejecución de tareas en TheEye es asincrónica por naturaleza. Esto significa que la tarea se va a ejecutar en segundo plano y el tiempo que tarda en completar varía. En general, no necesitamos esperar el resultado ya que lo podemos revisar cuando esté disponible.
35+
## Argumentos
1136

12-
Pero hay casos que requieren que se ejecute la tarea y se espere al resultado. Este caso es común cuando se quiere conectar APIs o usar tareas que requieren interacción de usuario, entre otros escenarios.
1337

14-
Esto puede hacerse usando la API en modo `sync`. la única limitación es el timeout de ejecución de la tarea. Se recomienda configurar el timeout alrededor de los 60 segundos. El comportamiento de los clientes se puede editar pero por experiencia recomendamos evitarlo de no ser estríctamente necesario...
38+
| Name | Values | Description |
39+
| ---- | ---- | ---- |
40+
| result | empty/null. is ignored | Result es la información informada por el Agente al finalizar la ejecución. En otros incluye execution log, output, lastline. |
41+
| full | empty/null. is ignored | Responde con el document Job completo asociado a la ejecución. El mismo documento puede ser obtenido haciendo un GET a la API de jobs |
42+
| parse | empty or a Number/Integer > 0 | El output de un job es almacenado en la base de datos como un Array de Strings, que si fuera encadenado serán argumentos de la siguiente tarea. La opción parse utilizara por defecto el índice 0 de este array de outputs y lo intentara interpretar como JSON. En algunos casos puede ser necesario utilizar un índice diferente al 0, sobre todo si se trabaja con outputs de tareas ya definidios en otras implementaciones. Usando parse=INDEX_NUM donde INDEX_NUM es un número entero del output. Si el índice no esta presente o no es posible interpretarlo se devuelve el output crudo |
1543

16-
## API Paths
1744

18-
| Metoodo | Dirección | Descripción | ACL |
19-
| ------- | --------------------------- | --------------------------- | ---- |
20-
| POST | /${customer}/task/${id}/job | [Run task](#esperar-por-el-output) | user |
45+
## Respuesta
2146

2247

23-
### NOTAS
48+
Por defecto la API Sync responde con el output obtenido de la ejecución de la tarea. El output es lo que desde la interfaz se visualiza en la sección "output" del resultado de la ejecución.
49+
50+
El output se almacena en la base de datos dentro del documento job. El job representa la instancia de ejecución de la tarea.
51+
52+
53+
| State | HTTP Status Code |
54+
| ---- | ---- |
55+
| success | 200 |
56+
| failure | 500 |
57+
58+
59+
### NOTES
60+
61+
* Por el momento solo es posible la ejecución de _Tareas Individuales_ .
62+
63+
64+
____
2465

25-
* Solo hay soporte para ejecución de **Tareas**. La ejecución de Workflows **NO es posible** en este momento.
2666

2767
## Ejemplos
2868

29-
### Esperar por el output
69+
Puede descargar e importa [esta receta utilizada para todos los ejemplos](/sync/Rest_API_Response.json ":ignore")
70+
71+
72+
### Esperando output
3073

3174
```bash
75+
3276
customer=""
3377
taskId=""
3478
token=""
3579

3680
curl -s -X POST "https://sync.theeye.io/${customer}/task/${taskId}/job?access_token=${token}" | jq .output
81+
82+
83+
```
84+
85+
### Ejemplo de resultado "failure"
86+
87+
88+
```bash
89+
90+
curl -i -X POST 'https://sync.theeye.io/${customer_id}/task/${task_id}/job?access_token=${token}' \
91+
--header 'content-type: application/json' \
92+
--data '{"task_arguments":[200]}'
93+
94+
```
95+
96+
97+
```http
98+
99+
HTTP/1.1 500 Internal Server Error
100+
X-Powered-By: Express
101+
Access-Control-Allow-Origin: *
102+
Access-Control-Allow-Methods: GET,PUT,PATCH,POST,DELETE,OPTIONS
103+
Access-Control-Allow-Credentials: true
104+
Access-Control-Allow-Headers: Origin, Accept, User-Agent, Accept-Charset, Cache-Control, Accept-Encoding, Content-Type, Authorization, Content-Length, X-Requested-With
105+
Content-Type: application/json; charset=utf-8
106+
Content-Length: 135
107+
ETag: W/"87-+Fzdxc2Q7NsFIfhclF3lcqgSScY"
108+
Date: Fri, 28 Jan 2022 16:59:54 GMT
109+
Connection: keep-alive
110+
Keep-Alive: timeout=5
111+
112+
["{\"message\":\"Validation Error. Invalid Argument Value\",\"statusCode\":418,\"name\":\"ClientError\",\"code\":\"\",\"status\":418}"]
113+
114+
115+
```
116+
117+
### Ejemplo de resultado "success"
118+
119+
120+
```bash
121+
122+
curl -i -X POST 'https://sync.theeye.io/${customer_id}/task/${task_id}/job?access_token=${token}' \
123+
--header 'content-type: application/json' \
124+
--data '{"task_arguments":[100]}'
125+
126+
```
127+
128+
```http
129+
130+
HTTP/1.1 200 OK
131+
X-Powered-By: Express
132+
Access-Control-Allow-Origin: *
133+
Access-Control-Allow-Methods: GET,PUT,PATCH,POST,DELETE,OPTIONS
134+
Access-Control-Allow-Credentials: true
135+
Access-Control-Allow-Headers: Origin, Accept, User-Agent, Accept-Charset, Cache-Control, Accept-Encoding, Content-Type, Authorization, Content-Length, X-Requested-With
136+
Content-Type: application/json; charset=utf-8
137+
Content-Length: 62
138+
ETag: W/"3e-Earn8PE7JwarkhTciq4Sn4inI3g"
139+
Date: Fri, 28 Jan 2022 17:00:22 GMT
140+
Connection: keep-alive
141+
Keep-Alive: timeout=5
142+
143+
["{\"name\":\"tomer\",\"date\":\"2022-01-28T17:00:22.676Z\"}"]
144+
37145
```
146+
147+
148+
### Ejemplo de "success" usando "parse"
149+
150+
151+
Get the ID and replace in the requests below
152+
153+
```bash
154+
155+
curl -i -X POST 'https://sync.theeye.io/${customer_id}/task/${task_id}/job?parse&access_token=${token}' \
156+
--header 'content-type: application/json' \
157+
--data '{"task_arguments":[100]}'
158+
159+
```
160+
161+
162+
```http
163+
164+
HTTP/1.1 200 OK
165+
X-Powered-By: Express
166+
Access-Control-Allow-Origin: *
167+
Access-Control-Allow-Methods: GET,PUT,PATCH,POST,DELETE,OPTIONS
168+
Access-Control-Allow-Credentials: true
169+
Access-Control-Allow-Headers: Origin, Accept, User-Agent, Accept-Charset, Cache-Control, Accept-Encoding, Content-Type, Authorization, Content-Length, X-Requested-With
170+
Content-Type: application/json; charset=utf-8
171+
Content-Length: 50
172+
ETag: W/"32-QGrCXrCY2sEcc1V/fL6omhdvPKY"
173+
Date: Fri, 28 Jan 2022 16:26:41 GMT
174+
Connection: keep-alive
175+
Keep-Alive: timeout=5
176+
177+
{"name":"tomer","date":"2022-01-28T16:26:41.201Z"}
178+
179+
```
180+
181+
### Ejemplo de "failure" usando "parse"
182+
183+
184+
```bash
185+
186+
curl -i -X POST 'https://sync.theeye.io/${customer_id}/task/${task_id}/job?parse&access_token=${token}' \
187+
--header 'content-type: application/json' \
188+
--data '{"task_arguments":[200]}'
189+
190+
```
191+
192+
193+
```http
194+
195+
HTTP/1.1 418 I'm a Teapot
196+
X-Powered-By: Express
197+
Access-Control-Allow-Origin: *
198+
Access-Control-Allow-Methods: GET,PUT,PATCH,POST,DELETE,OPTIONS
199+
Access-Control-Allow-Credentials: true
200+
Access-Control-Allow-Headers: Origin, Accept, User-Agent, Accept-Charset, Cache-Control, Accept-Encoding, Content-Type, Authorization, Content-Length, X-Requested-With
201+
Content-Type: application/json; charset=utf-8
202+
Content-Length: 115
203+
ETag: W/"73-FBmPIgGdDNzn6NM27joxlSUMWp4"
204+
Date: Fri, 28 Jan 2022 16:56:47 GMT
205+
Connection: keep-alive
206+
Keep-Alive: timeout=5
207+
208+
{"message":"Validation Error. Invalid Argument Value","statusCode":418,"name":"ClientError","code":"","status":418}
209+
210+
```
211+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"task":{"order":0,"enable":true,"type":"script","public":false,"tags":[],"grace_time":0,"task_arguments":[{"id":1,"order":0,"type":"input","label":"number","value":"","help":"","readonly":false,"required":true,"multiple":false,"masked":false,"charsmin":0,"charsmax":0,"charset":null,"pattern":"","options":[]}],"arguments_type":"legacy","output_parameters":[],"register_body":false,"execution_count":83,"multitasking":true,"show_result":false,"assigned_users":[],"user_inputs":false,"user_inputs_members":[],"empty_viewers":false,"cancellable":true,"autoremove_completed_jobs_limit":5,"script_arguments":[{"id":1,"order":0,"type":"input","label":"number","value":"","help":"","readonly":false,"required":true,"multiple":false,"masked":false,"charsmin":0,"charsmax":0,"charset":null,"pattern":"","options":[]}],"logging":false,"_type":"ScriptTask","creation_date":"2022-01-28T13:01:43.355Z","last_update":"2022-01-28T16:56:46.292Z","env":{"NODE_ENV":""},"name":"Rest API Response","description":"","timeout":600000,"allows_dynamic_settings":false,"script_runas":"node %script%","template":null,"template_id":null,"source_model_id":"61f3e937c38201da80f96c27"},"file":{"order":0,"filename":"api.js","keyname":"api.js[ts:1643388995376]","mimetype":"text/javascript","extension":"js","size":2079,"description":"","md5":"824a8455060c66ebce1408efb52652dd","public":false,"tags":[],"source_model_id":"61f3e92cc38201da80f96c26","data":"Ly8gZXJyb3IgYW5kIG91dHB1dCBoYW5kbGVycyBtdXN0IGdvIGZpcnN0LgoKLyoqCiAqIEBwYXJhbSB7T2JqZW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3Rpb24gKGtleSkgewogICAgICBpZiAoa2V5ID09PSAnc3RhY2snKSB7CiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSAncHJvZHVjdGlvbicpIHsKICAgICAgICAgIGFsdFtrZXldID0gdGhpc1trZXldCiAgICAgICAgfQogICAgICB9IGVsc2UgewogICAgICAgIGFsdFtrZXldID0gdGhpc1trZXldCiAgICAgIH0KICAgIH0KICAgIE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzKHRoaXMpLmZvckVhY2goc3RvcmVLZXksIHRoaXMpCiAgICByZXR1cm4gYWx0CiAgfQp9CgoKCi8vIGludm9rZSBtYWluIGFuZCBjYXB0dXJlIHJlc3VsdCBvdXRwdXQKbWFpbigpLnRoZW4oc3VjY2Vzc091dHB1dCkuY2F0Y2goZmFpbHVyZU91dHB1dCkK"}}

docs/sync/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![theeye.io](../images/logo-theeye-theOeye-logo2.png)](https://theeye.io/en/index.html)
1+
[![theeye.io](../../images/logo-theeye-theOeye-logo2.png)](https://theeye.io/index.html)
22

33
# Sync API
44

@@ -26,7 +26,6 @@ ___
2626

2727
## Arguments
2828

29-
By default the sync api will respond with the final output of the task execution. when a job finishes the output value is parsed and then stored withing the job document in the output field.
3029

3130
| Name | Values | Description |
3231
| ---- | ---- | ---- |
@@ -37,7 +36,7 @@ By default the sync api will respond with the final output of the task execution
3736

3837
## Response
3938

40-
By default the response will be the raw task outputs without parsing
39+
By default the sync api will respond with the final output of the task execution. when a job finishes the output value is parsed and then stored withing the job document in the output field.
4140

4241
| State | HTTP Status Code |
4342
| ---- | ---- |

0 commit comments

Comments
 (0)