OverView

REST ( Representation State Transfer) , the World Wide Web (www) is distributed as a software architectural style for improved system. 
JSON describes himself ( self-describing ) is a data exchange format.

LOGO Restful API

  • Data stores files as JSON
  • Thus, each processing performed in the product " JSON format through a URL " access makes it possible.
  • This web and mobile applications, Restful API is just one of the features that make this so powerful.

REST has become the most common web API design model.

Some of the advantages of the rest :
  • scalability of component interaction. 

  • the generality of interfaces

  • It is an independent distribution of components.

    REST also reducing the time delay, strengthen security and acts as a mediator between the application components, including legal systems.

    REST API can be used in any language can make HTTP calls.


    Priority issues to be taken into consideration when designing Restful API, developer productivity and success must be put up to the highest level.
    This is clear from the pragmatic REST expression.

    The design must be true because nothing expresses how to use design.

    So our question would be: What is the optimal level for design applications will benefit developers?
    Developer 's perspective, the basis of all subject-specific tips and best practice has been our principle that we have compiled


    Design Principles

    URLs :
    A number of pragmatic Restful design principle is to keep everything simple. Base URL must be simple and intuitive.

    Base URL design API ( affordance ) is the most important factor for. Simple and intuitive design, a base URL makes it easier to use the API.

    Affordances, the document is a design feature that can be used to express how anything without need.


j-platform WADL (Web Application Description Language)

Names

You should use verbs rather than names (SOAP --- RPC)

 Release 

URLs have driven (large, that for major version), you must make mandatory to choose the highest.


You can support a maximum of two versions simultaneously.

Base URL : https://<application uri>/rest/v{versiyon numarası} 

An example URL:   https://localhost:8080/logo/rest/v1.0/orders

Hierarchical Structure

URL to highlight the hierarchical nature of the structure ( aggregation or composition ) should strengthen .
Example: the lines in a desired order.
GET /orders/1234/transactions/1

Defining himself (self - descriptive ) :

Each resources, services and definitions to describe the REST service methods are applied.

a.  Swagger UI had the support

b. The purpose of the service method, not only the design but also to explain the operations you can do on REST objects.

GET / services call, it will return all the REST methods and definitions of all the objects in the REST.

http://localhost:8080/logo/rest/services

c. The purpose of defining the method, the object is to describe the design of REST.

GET / orders / describe the call will return a draft of the order object.
An Example URL :http://localhost:8080/logo/rest/v1.0/orders/describe

For more information  http://json-schema.org/ 

Security: OAuth2 & HTTPS

  • OAuth2 can use to manage authorization. OAuth2, 
  • Typing requirements of the client and that they adapt to 99%. 
  • Each API / HTTPS can be used for OAuth2 request. 
  • If possible, avoid log
  • If do the authentication for each request, if necessary.

  • (Stateless)

  • The construction authorization according to the source content. not by URL.

  • Username / password rather than use the API key.

    401 " Unauthorized " accuracy/authentication means have not been confirmed.
    " You need valid credentials for me to respond to this request."

    403 " Forbidden " means that you have authority.
     

    599 " logo Exchange Error" j- guar ' also made the error corresponds taken during the requested operation.
     " Receipt date must be within the financial period. "

Source Access: ( List + CRUD)

Common Query Options

Name

Compulsory

Defaults

Value Type

Meaning

Company

No

The user's default company

İnteger

Registration number of the company

Language

No

The default language for the user

String

Language name

Set

No

“”

String

Application variable "set" value
Example URL: https://localhost:8080/logo/rest/v1.0/orders?firm=1&language=TRTR&set=DRF  

GET

 Click for Detailed Information
Query options for GET operations

Name

Compulsary

Defaults

Value Type

Meaning

expandLevel

No

0

İnteger

Details of the access level of the object , the default object 0 is used only the title information

expand

No

“”

String

Will be expanded / opened to a comma-separated nested ( nested ) object names

fields

No

“”

String

comma-separated column names to be rotated

Example URL :

https://localhost:8080/logo/rest/v1.0/orders?firm=1&expandLevel=2

https://localhost:8080/logo/rest/v1.0/orders/12345?expand=Transactions&expandLevel=1

https://localhost:8080/logo/rest/v1.0/orders/12345?fields=slipNumber,orderDate,transactions(quantity,price)&expandLevel=2


Note: Net side, expand the child objects desired level is requested.

Registration List :

Base URL: https: // <application uri > / rest / obj { name} s

Example URL: https: // localhost: 8080 / logo / rest / v1.0 / orders

Response: 200 OK with JSON list of records

The HREF Id : UID database record ( MD5 of a generated UUID)

Gets the number of records : https: // <application uri > / rest / { version} / counter / { name} s obj

Example counter URI : https://localhost:8080/logo/rest/v1.0/count/orders

Query options:

Name

Cumpulsary

Defaults

Value type

Meaning

offset

No

0

İnteger

Start offset

limit

No

10

İnteger

Record count limit

sort

No

“”

String

comma (,) separated column names for query order

withCount

No

False

Boolean

Boolean indicating totalCount will be included in the result

Example URL:https://localhost:8080/logo/rest/v1.0/orders?q=slipNumber:A%20AND%20orderDate:[*%20TO%202016-02-23T00:00:00.000%2b02:00]

Single Main Records

Base URL: https: // <application uri > / rest / obj { name} s / { object id }

Example URL: https: // localhost: 8080 / logo / rest / v1.0 / orders / 12345

Response: 200 OK with JSON representation of the main record

Link Records – 1-N

Base URL: https://<application uri>/rest/{obj name}s/{object id}/{link object property name}

Example URL : https://localhost:8080/logo/rest/v1.0/orders/12345/Transactions

Response : 200 OK with JSON of linked list of records

Link Records – 1-1

Base URL: https://<application uri>/rest/{obj name}s/{object id}/{link object property name}

Example URL : https://localhost:8080/logo/rest/v1.0/orders/12345/Notes

Response : 200 OK with JSON of linked record

POST

 Click for Detailed information

Creating a new record

Base URL: https://<application uri>/rest/{obj name}s

Example URL : https://localhost:8080/logo/rest/v1.0/orders  with JSON of the object to create

Response : 201 Created or Error with explanation and error code

PUT

 Click for Detailed Information

Register to create or save

Base URL : https://<application uri>/rest/{obj name}s/{object id}

Example URL : https://localhost:8080/logo/rest/v1.0/orders/12345   with JSON of the object

Response : 200 OK for updates and 201 create for creates. 


f the process Put { object id } "0" is sent, as the insert in response to record logical record value ( LOGICALREF ) will return. 

IMPORTANT : This is equipotential . Put the same process again with different side effects and does not create the same again to call the REST API .

PATCH

 Click for Detailed Information

Registration portion updates available

Base URL : https://<application uri>/rest/{obj name}s/{object id}

Example URL : https://localhost:8080/logo/rest/v1.0/orders/12345

Response: 204 OK


Deleting the current record

 Click for Detailed Information

Base URL : https://<application uri>/rest/{obj name}s/{object id}

Example URL : https://localhost:8080/logo/rest/v1.0/orders/12345

Response : 204 OK

Sample Applications

JGuarRestSampleClientJava.rar  JGuarRestSampleClientDotNet.rar  JGuarRestSampleClientJavaScript.rar







Telif HakkıKullanım KoşullarıGizlilik
Copyright © 2018 Logo Yazılım