Giter Site home page Giter Site logo

thecore_api's Introduction

Chiamate non autenticate

Version is the typical call that won't require authentication, thus calling it directly

https://www.taris.it/development/hiworkflows/api/v1/info/version

which returns something like (JSON):

{
  "version": "1.0"
}

Chiamate autenticate con username e password:

To get the token back, you must provide auth credentials, in HTTP_BASIC form,

https://www.taris.it/development/hiworkflows/api/v1/info/token

Supposing admin:1234 as username:password, here is the sample of headers sent in which YWRtaW46MTIzNA== is the base64 encoding of admin:1234 :

Accept: application/json
Content-Type: application/json
Authorization: Basic YWRtaW46MTIzNA==
Accept-Language: it-it
Accept-Encoding: gzip, deflate

it returns the AUTH_TOKEN, email and id of the user which performed the authentication:

{
  "token": "VNCg+DCLyzFF3dWW6kdJXTP5c9CGvq1zVK+Pb4lc//9lvqP2sXNHAjg9L4SJK5M98tzZNuw7kV4VqbPMYk57UA==",
  "email": "[email protected]",
  "roles": [
    ""
  ],
  "admin": true,
  "third_party": false,
  "id": 3
}

In case you won't provide right credentials, this is the error you'll recieve:

{
  "error": "bad credentials"
}

Chiamate autenticate con token

Whe you get the token, you could use it to make a search:

https://www.taris.it/development/hiworkflows/api/v1/bundles?q[code_eq]=provasv

With headers (must be sure to send the Accept, Content-Type and Authorization ones):

Accept: application/json
Content-Type: application/json
Authorization: Token token="VNCg+DCLyzFF3dWW6kdJXTP5c9CGvq1zVK+Pb4lc//9lvqP2sXNHAjg9L4SJK5M98tzZNuw7kV4VqbPMYk57UA==", email="[email protected]"
Accept-Language: it-it
Accept-Encoding: gzip, deflate

Which will return an array of bundles which have provasv as code.

http://localhost:3000/api/v1/items?pages_info=1&page=1&per=3

{
  "count": 481,
  "current_page_count": 3,
  "next_page": 2,
  "prev_page": null,
  "is_first_page": true,
  "is_last_page": false,
  "is_out_of_range": false,
  "pages_count": 161,
  "current_page_number": 1
}

http://localhost:3000/api/v1/items?count=1

{
  "count": 481
}

thecore_api's People

Contributors

gabrieletassoni avatar

Watchers

James Cloos avatar  avatar

thecore_api's Issues

Add JWT to thecore-api

Make it as a component, thus if the component is present, it uses JWT, if component is not in the gem file, it uses the current token based method.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.