الفرق بين المراجعتين لصفحة «تصميم:دواسوا/API»

من ويكي أضِف
اذهب إلى التنقل اذهب إلى البحث
(data structures)
(requesting user listings)
 
(11 مراجعة متوسطة بواسطة نفس المستخدم غير معروضة)
سطر 2: سطر 2:
 
The API should implement the following verbs:
 
The API should implement the following verbs:
  
−
; <code>Lookup ( <var>name</var>: string, <var>count</var>: int, <var>index</var>: int )</code>
+
== <code>lookup</code> ==
−
: returns <var>count</var> number of listings having <var>name</var> as the name, starting with <var>index</var>
+
<code>( <var>name</var>: string, <var>count</var>: int, <var>index</var>: int ): listings-enumeration</code>
  
−
; <code>Insert_pending ( <var>package_info</var>: [[#package_info|package_info]], <var>contact_info:</var> [[#contact_info|contact_info]], <var>accept_terms</var>: boolean )</code>
+
Returns <var>count</var> number of listings having <var>name</var> as the name, starting with <var>index</var>. Each listing item is comprised of basic [[../data#package-info|package information]] sans [[../data#contact-info|contact information]] processed properly.
−
: initiates the process of inserting a listing. The final insertion into the index is completed with insert_instate. Where:
 
−
:* package_info : package information record as indicated in [[#package_info|package_info]]
 
−
:* contact_info : contact information record as indicated in [[#contact_info|contact_info]]
 
−
:* accept_terms : a flag indicating the acceptance of the terms of service.
 
  
−
Listing data record is comprised of the following two data structures:
+
This is a GET request via the URL <code>/lookup?<var>name</var>=&<var>count</var>=&<var>index</var>=</code>
−
== <var>package_info</var> ==
 
−
; <var>name</var> <nowiki>:</nowiki> string
 
−
: the name of the medicine in Latin script
 
−
; <var>name_arabic</var> <nowiki>:</nowiki> string
 
−
: the name of the medicine in Arabic script, if available (optional)
 
−
; <var>expiry</var> <nowiki>:</nowiki> date
 
−
: the date of expiry of the medicine. The significance is in the precision of months, i.e YYYY/MM
 
−
; <var>package_state</var> <nowiki>:</nowiki> string(<kbd>fabrica</kbd> | <kbd>opened</kbd> | <kbd>partial</kbd>) : The case of the packaging of the medicine.
 
−
; <var>governrate</var> <nowiki>:</nowiki> string(predefined)
 
−
: the governerate where the package is to be picked up
 
−
; <var>description</var> <nowiki>:</nowiki> text
 
−
: a brief description, and/or notes by the submitter
 
−
; <var>photo</var> <nowiki>:</nowiki> blob
 
−
: an optional photograph of the package
 
  
−
== <var>contact_info</var> ==
+
 
−
; <var>email_address</var> <nowiki>:</nowiki> string(email-address)
+
== <code>get_item_info</code> ==
−
:  
+
<code>( <var>id</var>: string(id) ): item-info</code>
−
; <var>name</var> <nowiki>:</nowiki> string
+
 
−
:
+
Returns details information on a specific listing item; comprised of the [[../data#package-info|package information]] and the [[../data#contact-info|contact information]].
−
; <var>phone_number</var> <nowiki>:</nowiki> string(phone-number)
+
 
−
:
+
This is a GET request via the URL <code>/item/<var>id</var></code>
−
; <var>email_address_visible</var> <nowiki>:</nowiki> boolean
+
 
 +
 
 +
== <code>request_insertion</code> ==
 +
<code>( <var>package-info</var>: [[../data#package-info|package-info]], <var>contact-info:</var> [[../data#contact-info|contact-info]], <var>accept-terms</var>: boolean )</code>
 +
 
 +
Initiates an [[../workflow#insertion request|insertion request]]. Where:
 +
* [[../data#package-info|package-info]] : package information record
 +
* [[../data#contact-info|contact-info]] : contact information record
 +
* accept-terms : a boolean flag indicating the acceptance of the terms of service.
 +
This request is a POST request
 +
 
 +
 
 +
== <code>instate_entry</code> ==
 +
<code>( <var>id</var>: string(id), <var>token</var>: string([[../cryptographic-token|token]]) )</code>
 +
 
 +
[[../workflow#Listing instatement|Instates a listing]] via user action.
 +
 
 +
This is a GET request via the URL <code>/instate-listing/<var>id</var>/<var>token</var></code>
 +
 
 +
 
 +
== <code>remove_entry</code> ==
 +
<code>( <var>id</var>: string(id), <var>token</var>: string([[../cryptographic token|token]]) )</code>
 +
 
 +
Initiates the [[../workflow#Listing removal|removal of a listing]] from the public listings into the [[../data#archive|archive]]. Listings removed via this procedure have a status flag <kbd>removed-by-user</kbd>.
 +
 
 +
This is a GET request via the URL <code>/remove/<var>id</var>/<var>token</var></code>
 +
 
 +
 
 +
== <code>request_user_listings</code> ==
 +
<code>( <var>email_address</var>, <var>token</var>: string([[../cryptographic token|token]]) )</code>
 +
 
 +
Initiates the [[../workflow#Inquiring user listings|retrieval of listings]] associated with a given user's email address.
  
 
</div>
 
</div>

المراجعة الحالية بتاريخ 23:17، 28 يناير 2017

The API should implement the following verbs:

lookup

( name: string, count: int, index: int ): listings-enumeration

Returns count number of listings having name as the name, starting with index. Each listing item is comprised of basic package information sans contact information processed properly.

This is a GET request via the URL /lookup?name=&count=&index=


get_item_info

( id: string(id) ): item-info

Returns details information on a specific listing item; comprised of the package information and the contact information.

This is a GET request via the URL /item/id


request_insertion

( package-info: package-info, contact-info: contact-info, accept-terms: boolean )

Initiates an insertion request. Where:

  • package-info : package information record
  • contact-info : contact information record
  • accept-terms : a boolean flag indicating the acceptance of the terms of service.

This request is a POST request


instate_entry

( id: string(id), token: string(token) )

Instates a listing via user action.

This is a GET request via the URL /instate-listing/id/token


remove_entry

( id: string(id), token: string(token) )

Initiates the removal of a listing from the public listings into the archive. Listings removed via this procedure have a status flag removed-by-user.

This is a GET request via the URL /remove/id/token


request_user_listings

( email_address, token: string(token) )

Initiates the retrieval of listings associated with a given user's email address.