elasticio / api-docs Goto Github PK
View Code? Open in Web Editor NEWDocs for elastic.io API
Docs for elastic.io API
STR:
curl -X GET \
https://api-sparrow.elastic.io/v2/organizations/59d22e7eeb865b0018adc247/ \
-H 'accept: application/json' \
-H 'authorization: Basic aGFubmEudHJvdHNlbmtvQGVsYXN0aWMuaW86OTc0MGE3OWMtOWRmNy00MDAyLTk3MjItMjc4YjkzNTU1OWIy' \
-H 'cache-control: no-cache' \
-H 'postman-token: 654844ce-fb04-1158-fae8-95a1663b5d7e'
ER: Only existed users are displayed
The delay between Retrieve component’s select model
and Poll a result of an execution
(talking about the same exec_ID) was about 40 minutes.
AR:
Poll a result of an execution
was:{
"data": {
"id": "5aafc115d0516d0007758238",
"type": "execution-result",
"links": {
"self": "/v2/exec/result/5aafc115d0516d0007758238"
},
"attributes": {
"result": {
"data": {
"available": "Available",
"pending": "Pending",
"sold": "Sold"
}
}
}
},
"meta": {}
}
Location
headers.Status code: 200
.ER:
Status code: 303
.Location
header.API docs say:
AUTHORIZATION
This request is authorized to only a user with TenantAdmin role (contact support to get this role).
STR:
AR:
{
"data": [
{
"id": "560e5a27734d480a00000002",
"type": "user",
"links": {
"self": "/v2/users/560e5a27734d480a00000002"
},
"attributes": {
"first_name": "Igor",
"last_name": "Drobiazko",
"email": "[email protected]",
"company": "elastic.io GmbH",
"registered": "2015-10-02T10:19:19.697Z",
"last_login": "2018-02-08T16:07:52.495Z"
}
}
],
"meta": {
"page": 1,
"per_page": 1,
"total": 646,
"total_pages": 646
}
}
ER: an error about authorization
Which is wrong
STR:
curl -X POST \
https://api-sparrow.elastic.io/v2/components/5a0eca5d2715bf0018058ba3/versions/latest/select-model \
-H 'authorization: Basic aGFubmEudHJvdHNlbmtvQGVsYXN0aWMuaW86ZGY4MTVlZTMtYjRiZi00MTE2LWFmN2MtMjczNWQ4YjA0YjY1' \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'postman-token: 8e39cfdb-68b8-c668-62f9-d8c82d3ab4c4' \
-d '{
"data": {
"type": "select-model",
"attributes": {
"module": "getPetsByStatusWithDynamicSelectModel",
"method": "getStatusModel",
"fields": {
"id" : "1",
"name" : "value",
"status" : "sold",
"category" : {
"id":"1",
"name":"dogs"
}
}
},
"relationships": {
"credential": {
"data": {
"id": "5a6f3e121030f30007bdfa57",
"type": "credential"
}
}
}
}
}'
"id"
from responsecurl -X GET \
https://api-sparrow.elastic.io/v2/exec/poll/{PREVIOUS_EXEC_ID} \
-H 'authorization: Basic aGFubmEudHJvdHNlbmtvQGVsYXN0aWMuaW86ZGY4MTVlZTMtYjRiZi00MTE2LWFmN2MtMjczNWQ4YjA0YjY1' \
-H 'cache-control: no-cache' \
-H 'postman-token: cc209853-5c66-bfe5-487d-12b7883ba875'
AR: The response is still
{
"data": {
"id": "5aafca05d0516d0007758a26",
"type": "execution-result",
"links": {
"self": "/v2/exec/result/5aafca05d0516d0007758a26"
},
"attributes": {
"result": {
"data": {
"available": "Available",
"pending": "Pending",
"sold": "Sold"
}
}
}
},
"meta": {}
}
ER:
{
"data": {},
"meta": {}
}
@khanzadyan commented on Fri Mar 09 2018
Documentation about removing a member from Organisation incorrectly states that tenantAdmin
API Key
must be used: https://api.elastic.io/v2/docs/#remove-member-from-organization
In reality, this action can be only be done by the Organisation Admin.
@HannaTrotsenko commented on Fri Dec 01 2017
STR:
ER:
curl https://api.elastic.io/v2/sshkeys/ \
-X POST \
-u [email protected]:cbe86fbf-708b-4020-b7d6-09bfef3fc24f \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' -d '
{
"data": {
"type": "sshkey",
"attributes": {
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDf0QiuqfcAMXK58vbHcS6DjPLk48ksR6xj/ApRF8GhzzEUtPdeqLEsf1MIJx61dd0E6UdmW4AIbwDcTOMWz0f+9Ue7AypkPwn+kt9y6JOdW+GC+f+2wJzR3ySgq8XGHwsHmANlegZIlzyFGqm4YbGdxqTtBENrJZGQpayGMcI72662HxAsCrAoENyCLPml+lWr6cYaK7r0WLEmoZefzuLgO3VMVIaGK9B+5unQ0R2UMozwJJutYTCJAlnTIvO3BceHcrNnEAjYuvx1khdNd3+4Mrs/Q1LTzavqVy/Ot9ZpK3xah4bnFHbcunVzlCeiY5HLTfrcSgmsa9xhgj+viMJj hanna@hanna-UX430UQ",
"title": "My New Key"
}
}
}'
API docs say:
AUTHORIZATION
This request is authorized to only a user with TenantAdmin role (contact support to get this role).
STR:
AR:
{
"data": {
"id": "5aabc258bd6d6400079b4592",
"type": "user",
"links": {
"self": "/v2/users/5aabc258bd6d6400079b4592"
},
"attributes": {
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"company": "Doe & Partners",
"registered": "2018-03-16T13:10:48.221Z",
"last_login": "2018-03-16T13:10:48.221Z"
}
},
"meta": {}
}
ER: an error about authorization
Update api-docs: add information about access level for Components-requests
@HannaTrotsenko commented on Fri Jan 19 2018
AR:
curl https://api.elastic.io/v2/components/{COMPONENT_ID}/env \
-X PUT
-u {EMAIL}:{APIKEY} \
-H 'Accept: application/json'
-H 'Content-Type: application/json' -d '
{
"data": {
"type": "component-env",
"attributes": {
"vars": {
"MY_ENV_VAR": "env_var_value"
}
}
}
}'
ER:
curl https://api-sparrow.elastic.io/v2/components/5a4f3e34cbe7940019697e87/env \
-X PUT \
-u [email protected]:df815ee3-b4bf-4116-af7c-2735d8b04b65 \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' -d '
{
"data": {
"type": "component-env",
"attributes": {
"vars": {
"": "EMPTY_env_var_value"
}
}
}
}'
API docs say:
AUTHORIZATION
This request is authorized to only a user with TenantAdmin role (contact support to get this role).
STR:
AR:
{
"data": {
"id": "59d3562c68ed850019bde27f",
"type": "user",
"links": {
"self": "/v2/users/59d3562c68ed850019bde27f"
},
"attributes": {
"first_name": "Oksana",
"last_name": "Luzha",
"email": "[email protected]",
"company": "qaz",
"registered": "2017-10-03T09:19:40.598Z",
"last_login": "2018-03-16T10:30:38.656Z"
}
},
"meta": {}
}
ER: an error about authorization
I think cUrl for creating flow is too ancient:
curl https://api.elastic.io/v2/flows \
-u {EMAIL}:{APIKEY} \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' -d '
{
"data": {
"type": "flow",
"attributes": {
"name": "Timer to E-Mail",
"type": "ordinary",
"graph": {
"nodes": [
{
"id": "step_1",
"command": "elasticio/timer:timer",
"fields": {
"interval": "minute"
}
},
{
"id": "step_2",
"command": "elasticio/email:send"
}
],
"edges": [
{
"source": "step_1",
"target": "step_2",
"config": {
"mapper": {
"to": "[email protected]",
"subject": "Test",
"textBody": "{{fireTime}}"
}
}
}
]
}
}
}
}'
In the doc: This resource allows you to retrieve a credential by its identifier. If the credential with given ID does not belong to the current user an error is returned.
BUT in real: user can receive information about the credential, which belongs another user
We should provide a list of permission that belongs to service accounts at docs/v2/#tenants section
API docs say:
AUTHORIZATION
This request is authorized to only a user with TenantAdmin role (contact support to get this role).
STR:
AR:
{
"data": {},
"meta": {}
}
ER: an error about authorization
{
"errors": [
{
"status": 403,
"title": "Error",
"detail": "You cannot access this resource"
}
]
}
API docs say:
AUTHORIZATION
This request is authorized to only a user with TenantAdmin role (contact support to get this role).
STR:
AR:
204 No Content
ER: an error about authorization
@HannaTrotsenko commented on Mon Mar 12 2018
curl 'https://api-sparrow.elastic.io/v2/flows?filter[status]=active&filter[user]=59d22e7eeb865b0018adc248&filter[type]=ordinary' \
-g -u [email protected]:a398e3fe-dc28-4d32-9a2d-2a55654468ce
{
"data": [
{
"id": "5aa683400581b5000739c192",
"type": "flow",
"links": {
"self": "/v2/flows/5aa683400581b5000739c192"
},
"attributes": {
"api_version": "2.0",
"created_at": "2018-03-12T13:40:16.090Z",
"current_status": "active",
"default_mapper_type": "jsonata",
"description": null,
"graph": {
"nodes": [
{
"id": "step_1",
"command": "elasticio/code:executeTrigger@latest",
"name": "",
"description": "",
"fields": {
"code": "// Please note only Node.js code is supported here\nconsole.log('Hello code, incoming message is msg=%j', msg);\n\n// Create message to be emitted\nvar data = messages.newMessageWithBody({message: 'hello world'});\n\n// Emit the data event\nemitter.emit('data', data);\n\n// No need to emit end\nconsole.log('Finished execution');"
},
"selected_data_samples": [
"5aa6834c0581b5000739c193"
],
"out_data_samples": [
"5aa6834c0581b5000739c193"
]
}
],
"edges": []
},
"name": "active",
"status": "active",
"type": "ordinary",
"updated_at": "2018-03-12T13:44:56.037Z"
},
"relationships": {
"user": {
"data": {
"id": "59d22e7eeb865b0018adc248",
"type": "user"
},
"links": {
"self": "/v2/users/59d22e7eeb865b0018adc248"
}
},
"organization": {
"data": {
"id": "5aa681800581b5000739c190",
"type": "organization"
},
"links": {
"self": "/v2/organizations/5aa681800581b5000739c190"
}
},
"versions": {
"links": {
"related": "/v2/flows/5aa683400581b5000739c192/versions"
}
},
"latest_version": {
"data": {
"id": "12cf7376a34e34b2c4bcda3e35ae84cecc88519c",
"type": "flow-version"
},
"links": {
"self": "/v2/flows/5aa683400581b5000739c192/versions/12cf7376a34e34b2c4bcda3e35ae84cecc88519c",
"related": "/v2/flows/5aa683400581b5000739c192/versions/12cf7376a34e34b2c4bcda3e35ae84cecc88519c"
}
}
}
},
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"data": [
{
"type": "flow",
"id": "585918da586224001b96de89",
"attributes": {
"name": "Timer to E-Mail Test",
"status": "inactive",
"type": "ordinary",
"graph": {
"nodes": [
{
"id": "step_1",
"command": "elasticio/timer:timer",
"fields": {
"interval": "minute"
}
},
{
"id": "step_2",
"command": "elasticio/email:send"
}
],
"edges": [
{
"source": "step_1",
"target": "step_2",
"config": {
"mapper": {
"to": "[email protected]",
"subject": "Test",
"textBody": "{{fireTime}}"
}
}
}
]
}
},
"relationships": {
"user": {
"data": {
"type": "user",
"id": "560e5a27734d480a00000002"
},
"links": {
"self": "/v2/users/560e5a27734d480a00000002"
}
},
"organization": {
"data": {
"type": "organization",
"id": "573dd76962436c349f000003"
},
"links": {
"self": "/v2/organizations/573dd76962436c349f000003"
}
}
}
}
],
"meta": {
"page": 1,
"per_page": 20,
"total": 1,
"total_pages": 1
}
}
"header_logo_url":"//cdn.elastic.io/logo-mini.png",
"loading_logo_url":"//cdn.elastic.io/logo-mini.png",
"email_logo_url":"//cdn.elastic.io/logo-mini.png",
"favicon_url":"//cdn.elastic.io/logo-mini.png",
"terms_of_usage_url":"https://www.elastic.io/tou/",
"privacy_policy_url":"https://www.elastic.io/privacy-policy/",
"imprint_url":"https://www.elastic.io/legal-disclosure/",
"documentation":"https://docs.elastic.io/"
In the example of a task at https://api.elastic.io/docs/#create-task param named as account
but actually, it doesn't work.
I've found, that it works with _account
as param name.
So it would be very nice to update either docs or real name in API.
@zubairov commented on Wed Jan 10 2018
See this screenshot:
Difference is highlighted with the red arrows.
@khanzadyan commented on Wed Jan 10 2018
And this is the correct one: https://api.elastic.io/v2/organizations/{ORGANIZATION_ID}/invites/
Retrieve your user
AR: The real response
{
"data": {
"id": "59d22e7eeb865b0018adc248",
"type": "user",
"links": {
"self": "/v2/users/59d22e7eeb865b0018adc248"
},
"attributes": {
"first_name": "Anna",
"last_name": "Trotsenko",
"email": "[email protected]",
"company": "elastic.io",
"registered": "2017-10-02T12:18:06.274Z",
"last_login": "2018-03-15T16:53:57.696Z"
}
},
"meta": {}
}
ER: Example Response
{
"data": {
"id": "54f4be3fe7d5224f91000001",
"type": "user",
"attributes": {
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]"
}
}
}
In the doc: User without organization can get only own samples.
But in the real: we don't have any user without organization
last_modified
is sort by date of update with PUT /v2/flows
To add information, that user can change the level of access just only in one case: from team
to tenant
This functionality is referenced in this article however it is not in the API documentation. We should add documentation for this endpoint.
In the doc: This resource allows you to retrieve all credentials belonging to the given user.
AR: the user receives all credentials, belonging to all members of his organization
https://api.elastic.io/docs/#create-task
It seems that param action
has been renamed into function
and description is outdated.
https://github.com/elasticio/api/blob/master/v2/routes/resources/index.js#L15
Please see how a similar resource was documented in API v1. Note that in v1 the resource was called resources/s3/signed-url
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.