Available Methods

You can communicate with the the REST API using the following methods.

Search Method

Search method provides you with the ability to search for a document and it will return a json response of the available documents at the shop.

Search Method URL :

://www.terastandard.com/shop/api/search

Search Method Parameters

This method accepts 3 parameters namely, q,year,publisher

q : The search term

This is your search keyword. It accepts an string and it should be in the format of a standard code.

Examples for search term q

ASTM
ASTM D22
API 570
DIN 820-2
ISO 16631
BSI BS EN 60424
ANSI INCITS 469

year : The year of publication. It accepts a 4 digit like 2012

publisher : The publisher. It accepts an string

Examples for publisher parameter publisher

DIN
ISO
ASTM
BSI
ASHRAE
ASME
IEC
SAE
JIS
AASHTO
ACI
UL
API
IEEE
ANSI
ICAO
NFPA
AA
AATCC
ASCE
AWS
GPA
ICC
IES
IPC 
ISA
JIS
NACE
AWWA
...

Search method output

The method return a json response.

on error: When something goes wrong or there is not results. Please note that the status key will be false in this case.

on success: if the request is processed successfully it will return data with the status key being true

Example 1

Here is how to search for an standard code using the q parameter

://www.terastandard.com/shop/api/search?q=ASTM

Example 2

Here is how to search for an standard code using the q parameter and year

://www.terastandard.com/shop/api/search?q=ASTM&year=2012

Example 3

Here is how to search for an standard code using the q,year and publisher

://www.terastandard.com/shop/api/search?q=D22&year=2012&publisher=ASTM

Example 4

Example of an irrelevant search

http://www.terastandard.com/shop/api/search?q=something-irrelevant

result

{
    "status": false,
    "error": "No Results for your search!"
}

Example 5

Example of an correct search

http://www.terastandard.com/shop/api/search?q=D22&publisher=ASTM&year=2016

result:

{
    "status": true,
    "results": [
        {
            "id": "astm-d2234d2234m-155",
            "title": "ASTM D2234/D2234M",
            "name": "Standard Practice for Collection of a Gross Sample of Coal",
            "year": 2016,
            "publisher": "ASTM",
            "pages": 5,
            "price": 2100
        }
    ]
}

Buy Method

This method is designed to purchase the pdf file form the store. It will accept the id of the document and upon success it will return the URL of the pdf file.

Notice There should be enough balance in your user account at the shop to be able to purchase a document.

Notice By hitting this method your account will be charged for the price of that document upon successful purchase.

Base URL

http://www.terastandard.com/shop/api/buy

Buy method parameters

There is only one parameter for this method which is id. The id Should be exactly the same as you get from the search method results.

as an example you should pass it like:

id=astm-d2234d2234m-155

Buy method output

The method return a json response.

on error: When something goes wrong or there is not results. Please note that the status key will be false in this case.

on success: if the request is processed successfully it will return data with the status key being true and the file which is the URL of the PDF file.

Example 1

Example of an incorrect action

http://www.terastandard.com/shop/api/buy?id=22

result

{
    "status": false,
    "error": "No items found!"
}

Example 2

Example of an correct action

http://www.terastandard.com/shop/api/buy?id=astm-d2234d2234m-155

result

{
    "status": true,
    "file": "http://www.terastandard.com/downloads/terastandard_astm-d2234d2234m-155-1497626940.pdf"
}

.

results matching ""

    No results matching ""