0% encontró este documento útil (0 votos)
36 vistas21 páginas

Guía de Uso de NO2NO2 APIs

Este documento proporciona una descripción general de la API REST de NO2NO2, incluyendo recursos como compañías, ofertas, categorías, usuarios, comentarios de ofertas y "me gusta" de ofertas. Describe los métodos comunes de listado y paginación, esquemas de error, formatos de imagen, parámetros de filtro y procesos de registro y autenticación de usuarios.
Derechos de autor
© © All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como PDF, TXT o lee en línea desde Scribd
0% encontró este documento útil (0 votos)
36 vistas21 páginas

Guía de Uso de NO2NO2 APIs

Este documento proporciona una descripción general de la API REST de NO2NO2, incluyendo recursos como compañías, ofertas, categorías, usuarios, comentarios de ofertas y "me gusta" de ofertas. Describe los métodos comunes de listado y paginación, esquemas de error, formatos de imagen, parámetros de filtro y procesos de registro y autenticación de usuarios.
Derechos de autor
© © All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como PDF, TXT o lee en línea desde Scribd

NO2NO2 APIS

RSS

4102 –

1
NO2NO2 APIS

Common:
Server IP:
http://server.no2no2.net

URL Base for Rest API:


/api/

Common Error Scheme:

HTTP 401 when the user is not authorized to access a resource

HTTP 404 when the resource you are trying to find is not found

HTTP 500 when an internal server error occurs

Error contents are JSON:


{"errorCode": 1, "message": "Company Not Found"}

Common Listing and Pagination Methodology:

For ANY resource you list it this way:

[Server IP][URL Base][Resource]/?current=1&rowCount=10&searchPhrase=

Where current is the current page, and rowCount are the rows count you want to pull.

Say you want to pull first 10 you ask for current1 and rowCount 10, to get next ten, you
set current to 2 and rowCount to 10.

searchPhrase is the phrase you want to search for if you want to search.. if not then just
ignore it.

One more advanced thing to do is to send a request for sort.. as an additional parameter
of the form:

&sort[FIELD_NAME]=[asc/desc]

Where field name is one of the fields you received from the service and asc/desc are the
sorting methodologies.

2
NO2NO2 APIS

You then Receive:

{
"current":0,
"rowCount":10,
"total":8,
"rows":[
{ENTITY}, {ENTITY} ... etc
]
}

Where current and rowCount are the ones you have sent... Except for current it will be
minus one..

Entity is the form of the entity of the specific resource you requested.

total is the total count to know what's ahead.

In addition to these parameter, every resource might has its own filtering parameters.

Images and Resolutions:

For images you get the image base, or base name, for companies it is named logoBase,
for offers it is pictureBase.

Basically the URL for an image is as follows:

[Server IP]:8080/[Resource Base][base]_[RESOLUTION].png

where [RESOLUTION] can be:

LDPI 0.75 X
MDPI 1 X
HDPI 1.5 X
XHDPI 2 X
XXHDPI 3 X
XXXHDPI 4 X

iOS can simply use MDPI for regular resolution and XHDPI for retina displays.

An example is a URL for a company logo in MDPI format:

http://server.no2no2.net:8080/company/54A2BC853F2A36807A13739A5CC4A96B6777
CB3CCDED13D12ED0140ADA84DEFA0E7874EC74FEF4948828EDFF64AB2B731F8E5DA1
C48D70F9AD52D2132E781602_MDPI.png

3
NO2NO2 APIS

Company Resource:
Resource Base:

company/

Entity:

company/[Company Id]

And you Get:

{
"id":14,
"name":"‫"شركة زارا للملبوسات العالمية‬,
"nameEng":"Zara International Fashion Company",
"miniName":"‫"زارا‬,
"miniNameEng":"ZARA",
"contactDetails":[
{
"type":"FACEBOOK",
"contactValue":"ZARA_Co"
},
{
"type":"PHONE",
"contactValue":"+2 1298732616"
},
{
"type":"EMAIL",
"contactValue":"[email protected]"
},
{
"type":"TWITTER",
"contactValue":"ZARA.CO"
},
{
"type":"INSTAGRAM",
"contactValue":"ZARA"
}
],
"logoBase":"54A2BC853F...",

"offersCount": 1
}

4
NO2NO2 APIS

Offer Resource:
Resource Base:

offer/

Entity:

offer/[Offer Id]

And you Get:

{
"id":1,
"title":"‫"قميص فاخر جدا‬,
"titleEng":"Shirt Raheeb",
"companyId": 1,
"companyName": "‫"زارا للملبوسات العالمية‬,
"companyNameEng": "ZARA",
"companyMiniName": "‫"زارا‬,
"companyMiniNameEng": "ZARA",
"companyLogoBase": "31E5813...",
"publishTimestamp":112321454,
"endTimestamp":0,
"pictureBase":"31E581352D...",
"likesCount":0,
"commentsCount":0,
"viewsCount":0,
"isSpecial":false
}

Additional Filters to Listing:

companyId

It is used to filter the offers listing for a specific company Id.

Alternative way is to use company/[Company Id]/offers.

special

It is used to filter the offers listing to be special or not.

Expected values are either empty for all, true for special, and false for not special.

5
NO2NO2 APIS

categoryId

It is used to filter the offers for a specific category.

6
NO2NO2 APIS

Category Resource:
Resource Base:

category/

Entity:

category/[Category Id]

And you Get:

{
"id":1,
"title":"‫"سيارات‬,
"titleEng":"Cars",
"logoBase":"1"
}

Additional Filters to Listing:

all

It is used to get all categories and ignore the paginator.

7
NO2NO2 APIS

User Resource:
Resource Base:

user/

Entity:

user/me?accessToken=[Your Network Access Token]&network=[Your Network]

And you Get:

{
"id":1,
"userId":"10152193608746710",
"name":"Mohammed El-Khoudary",
"network":"FACEBOOK",
"platform":"ANDROID",
"deviceToken":"fds434r",
"timestampAdded":1413570538453,
"largePictureURL":"...",
"smallPictureURL":"...",
"pushNotificationEnabled": true
}

Profile Picture are taken from the provided URLs, regardless to the social network.

8
NO2NO2 APIS

User Sign-Up:
Resource Base:

user/

To Sign Up you POST to the Previous URL:

POST Parameters:

platform Your device platform:


ANDROID
IOS
...

deviceToken Your device Token for Push


Notifications.

pushNotification To allow or disallow push


notifications, true/false

Header Parameters:

Authorization The access token of your network

Network Your network type:


FACEBOOK
TWITTER
...

Response is:

Either an error status with an explaining JSON or the id of the user.


{“id”: [Generated Id]}
Note:
If you’re already signed up and you posted to that URL you will get your previous id.

9
NO2NO2 APIS

To Modify User Properties you POST to:

user/me
POST Parameters:

pushNotification To allow or disallow push


notifications, true/false

Response is:

Either an error status with an explaining JSON or a success response.


{“success”: true}

10
NO2NO2 APIS

Offer Comments:
Resource Base:

offer/[Offer Id]/comments/

Entity:

A list of offer comments in the regular list structure but each with the following entity
representation:

"id":2,

"userId":1,

"userFullName":"Mohammed El-Khoudary",

"userProfilePic":"http://...",

"userProfilePicMini":"http://...",

"offerId":1,

"commentBody":"‫"و هللا هادا كتير مرتب‬,

"timestampCreated":1413784311384

11
NO2NO2 APIS

To Write a Comment you POST to the Same URL:

POST Parameters:

commentBody Your Comment body

Header Parameters:

Authorization The access token of your network

Network Your network type:


FACEBOOK
TWITTER
...
Response is:

Either an error status with an explaining JSON or the id of the comment.


{“id”: [Generated Id]}
To Delete a Comment you DELETE to the following URL:

offer/[Offer Id]/comments/[Comment Id]

Header Parameters:

Authorization The access token of your network

Network Your network type:


FACEBOOK
TWITTER
...

Response is:

Either an error status with an explaining JSON or a success response.


{“success”: true}

12
NO2NO2 APIS

Offer Likes:
Resource Base:

offer/[Offer Id]/likes/

Entity:

A list of offer likes in the regular list structure but each with the following entity
representation:

"id":1,

"userId":1,

"userFullName":"Mohammed El-Khoudary",

"offerId":2,

"timestampCreated":1413610897475

To Like an Offer you POST to the Same URL:

Header Parameters:

Authorization The access token of your network

Network Your network type:


FACEBOOK
TWITTER
...

Please note that you should sign up before using this service.
Response is:

Either an error status with an explaining JSON or the id of the comment.


{“id”: [Generated Id]}

13
NO2NO2 APIS

To Delete a Like you DELETE to the following URL:

offer/[Offer Id]/likes/me

Header Parameters:

Authorization The access token of your network

Network Your network type:


FACEBOOK
TWITTER
...

Response is:

Either an error status with an explaining JSON or a success response.


{“success”: true}

14
NO2NO2 APIS

Offer Views:
Resource Base:

offer/[Offer Id]/views/

Entity:

A list of offer views in the regular list structure but each with the following entity
representation:

"id":1,

"userId":1,

"offerId":2,

"timestampCreated":1413610897475

To View an Offer you POST to the Same URL:

Header Parameters:

Authorization The access token of your network

Network Your network type:


FACEBOOK
TWITTER
...

Please note that you should sign up before using this service.

Response is:

Either an error status with an explaining JSON or the id of the comment.


{“id”: [Generated Id]}

15
NO2NO2 APIS

Offer Watches:
Resource Base:

offer/[Offer Id]/watches/

Entity:

A list of offer watches in the regular list structure but each with the following entity
representation:

"id":1,

"userId":1,

"offerId":2,

"timestampCreated":1413610897475

To Watch an Offer you POST to the Same URL:

Header Parameters:

Authorization The access token of your network

Network Your network type:


FACEBOOK
TWITTER
...

Please note that you should sign up before using this service.

Response is:

Either an error status with an explaining JSON or the id of the comment.


{“id”: [Generated Id]}

16
NO2NO2 APIS

To Delete a Watch you DELETE to the following URL:

offer/[Offer Id]/watches/me

Header Parameters:

Authorization The access token of your network

Network Your network type:


FACEBOOK
TWITTER
...

Response is:

Either an error status with an explaining JSON or a success response.


{“success”: true}

17
NO2NO2 APIS

Company Favoriting:
Resource Base:

company/[Company Id]/favorites/

Entity:

A list of offer watches in the regular list structure but each with the following entity
representation:

"id":1,

"userId":1,

"offerId":2,

"timestampCreated":1413610897475

To Favorite a Company you POST to the Same URL:

Header Parameters:

Authorization The access token of your network

Network Your network type:


FACEBOOK
TWITTER
...

Please note that you should sign up before using this service.

Response is:

Either an error status with an explaining JSON or the id of the comment.


{“id”: [Generated Id]}

18
NO2NO2 APIS

To Delete a Favorite you DELETE to the following URL:

offer/[Offer Id]/favorites/me

Header Parameters:

Authorization The access token of your network

Network Your network type:


FACEBOOK
TWITTER
...

Response is:

Either an error status with an explaining JSON or a success response.


{“success”: true}

19
NO2NO2 APIS

User Favorited Companies:


Resource Base:

user/me/favorited/

Entity:

A list of user favorite companies in the regular list structure and additionally in each
object there will be the corresponding favorited company object:

User Watched Offers:


Resource Base:

user/me/watched/

Entity:

A list of user offers watches in the regular list structure and additionally in each object
there will be the corresponding watched offer object:

User Likes on Offers:


Resource Base:

user/me/likes/

Entity:

A list of user offers likes in the regular list structure and additionally in each object
there will be the corresponding liked offer object:

20
NO2NO2 APIS

User Views on Offers:


Resource Base:

user/me/views/

Entity:

A list of user offers likes in the regular list structure and additionally in each object
there will be the corresponding liked offer object:

User Comments on offers:


Resource Base:

user/me/comments/

Entity:

A list of user offers comments in the regular list structure.

21

También podría gustarte