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

من ويكي أضِف
اذهب إلى التنقل اذهب إلى البحث
(data structures)
(API requests)
سطر 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 ( <var>name</var>: string, <var>count</var>: int, <var>index</var>: int ): listings-enumeration</code> ==
−
: returns <var>count</var> number of listings having <var>name</var> as the name, starting with <var>index</var>
+
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 [[#package-info|package information]] sans [[#contact-info|contact information]] processed properly.
  
−
; <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>
+
This is a GET request via the URL <code>/lookup?<var>name</var>=&<var>count</var>=&<var>index</var>=</code>
−
: 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.
 
  
 +
 +
== <code>get_item_info ( <var>id</var>: string(id) ): item-info</code> ==
 +
 +
Returns details information on a specific listing item; comprised of the [[#package-info|package information]] and the [[#contact-info|contact information]].
 +
 +
This is a GET request via the URL <code>/item/<var>id</var></code>
 +
 +
 +
== <code>request_insertion ( <var>package-info</var>: [[#package-info|package-info]], <var>contact-info:</var> [[#contact-info|contact-info]], <var>accept-terms</var>: boolean )</code> ==
 +
Initiates an [[../workflow#insertion request|insertion request]]. Where:
 +
* [[#package-info|package-info]] : package information record
 +
* [[#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_listing ( <var>token</var>: string([[/cryptographic-token|cryptographic token]]) )</code> ==
 +
[[workflow#Listing instatement|Instates a listing]] via user action.
 +
 +
This is a GET request via the URL <code>/instate-listing/<var>cryptographic-token</var></code>
 +
 +
 +
== <code>request_removal ( <var>id</var>: string(id) )</code> ==
 +
Initiates a [[../workflow#removal request|listing deletion request]]
 +
 +
This is a GET request via the URL <code>/delete-request/<var>cryptographic-token</var></code>
 +
 +
 +
== <code>remove_listing ( <var>token</var>: string([[/cryptographic token|cryptographic token]]) )</code> ==
 +
Initiates the [[../workflow#Listing removal|removal of a listing]] from the public listings into the archive. Listings removed via this procedure have a status flag <kbd>by-user</kbd>.
 +
 +
 +
== <code>get_user_listings ( <var>email-address</var> )</code> ==
 +
Initiates a [[../workflow#Listings retrieval|listings retrieval]] procedure
 +
 +
 +
=== data structures ===
 
Listing data record is comprised of the following two data structures:
 
Listing data record is comprised of the following two data structures:
−
== <var>package_info</var> ==
+
 
 +
=== <var>package_info</var> ===
 
; <var>name</var> <nowiki>:</nowiki> string
 
; <var>name</var> <nowiki>:</nowiki> string
 
: the name of the medicine in Latin script
 
: the name of the medicine in Latin script
سطر 27: سطر 61:
 
: an optional photograph of the package
 
: an optional photograph of the package
  
−
== <var>contact_info</var> ==
+
 
 +
=== <var>contact_info</var> ===
 
; <var>email_address</var> <nowiki>:</nowiki> string(email-address)
 
; <var>email_address</var> <nowiki>:</nowiki> string(email-address)
−
:  
+
: email address identifies a user who enlists an item. It is used to communicate with the user to confirm his listing, and to confirm the removal of a listing. It's a user's means to control his listings. It could be made invisible to viewers of a listing unless no phone number is given, in which case it is the only means to contact the user by those interested in a listing.
 
; <var>name</var> <nowiki>:</nowiki> string
 
; <var>name</var> <nowiki>:</nowiki> string
−
:
+
: A friendly name to greet the user by those contacting regarding a listing.
 
; <var>phone_number</var> <nowiki>:</nowiki> string(phone-number)
 
; <var>phone_number</var> <nowiki>:</nowiki> string(phone-number)
−
:
+
: An optional method to contact a user by those interested in a listing. If entered then it is visible.
 
; <var>email_address_visible</var> <nowiki>:</nowiki> boolean
 
; <var>email_address_visible</var> <nowiki>:</nowiki> boolean
−
 
+
: Determines whether the email address is visible. Ignored if no valid phone number is entered.
 
</div>
 
</div>

مراجعة 14:39، 31 ديسمبر 2016

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_listing ( token: string(cryptographic token) )

Instates a listing via user action.

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


request_removal ( id: string(id) )

Initiates a listing deletion request

This is a GET request via the URL /delete-request/cryptographic-token


remove_listing ( token: string(cryptographic token) )

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


get_user_listings ( email-address )

Initiates a listings retrieval procedure


data structures

Listing data record is comprised of the following two data structures:

package_info

name : string
the name of the medicine in Latin script
name_arabic : string
the name of the medicine in Arabic script, if available (optional)
expiry : date
the date of expiry of the medicine. The significance is in the precision of months, i.e YYYY/MM
package_state : string(fabrica | opened | partial)
The case of the packaging of the medicine.
governrate : string(predefined)
the governerate where the package is to be picked up
description : text
a brief description, and/or notes by the submitter
photo : blob
an optional photograph of the package


contact_info

email_address : string(email-address)
email address identifies a user who enlists an item. It is used to communicate with the user to confirm his listing, and to confirm the removal of a listing. It's a user's means to control his listings. It could be made invisible to viewers of a listing unless no phone number is given, in which case it is the only means to contact the user by those interested in a listing.
name : string
A friendly name to greet the user by those contacting regarding a listing.
phone_number : string(phone-number)
An optional method to contact a user by those interested in a listing. If entered then it is visible.
email_address_visible : boolean
Determines whether the email address is visible. Ignored if no valid phone number is entered.