api

Atlas API

API Endpoint: Import
Import till Marknadsdatabasen 2
Endpoint URL http://www.example.com/admin/edit/mdb_buildings/plain/api
Note that this API requires authenticated user id and IP address and a hashed api credential Note that this API requires authenticated user id and IP address and a hashed api credential

Use the API Credentials module in admin to set up API access for this module
  • insert_post

  • Information


    ARRAY should be an array with PHP notation, as such: data[citynet]=MNCMSN&data[city]=Hallstahammar...

    The array sent must follow the MdB2 specification

    All values is validated and aa error will be returned if it doesn't validate and the post isn't accepted.

    All data is inserted into the DB as a new post or updates an already existing post depending on the data
  • Parameters


    1 hash string green abcd Your login hash from api_login()
    2 data array green ARRAY An array of fields to be inserted to the database
    Example Query:
    http://www.example.com/admin/edit/mdb_buildings/plain/api?method=insert_post&hash=abcd&data=ARRAY
  • success response


       <insert_post>
          <response>
             <message>Inserted 1 post successfully</message>
          </response>
          <status>success</status>
       </insert_post>
  • empty_database

  • Information


    Will empty the database connected to the site you execute the command on.
  • Parameters


    3 hash string green abcd Your login hash from api_login()
    Example Query:
    http://www.example.com/admin/edit/mdb_buildings/plain/api?method=empty_database&hash=abcd
  • success response


       <empty_database>
          <response>
             <message>Deleted all posts from MDb2 where citynet is 'ABC'</message>
          </response>
          <status>success</status>
       </empty_database>
  • insert_posts

  • Information


    ARRAY should be an array of arrays with PHP notation, as such: posts[post1][coID]=MNCMSN&posts[post1][city]=Hallstahammar&posts[post1][streetName]=... where "post1" is the index of the post in the array.

    The array accepted can only contain a maximum of 100 arrays (posts) for each request. If you have 1000 posts to insert, you need to run this function 10 times. The API will return how many posts that validated and was thus entered to the database.

    Using "post###" (no spaces!) as the key for each array (post) in the request helps you understand possible error messages easier, if you have an internal ID for the data, it might be wise to use that (i.e. posts[293749][coID]=MNCMSN)

    Each post is then handled the same way as via the insert_post() method, see further information in that method
  • Parameters


    4 hash string green abcd Your login hash from api_login()
    5 posts array green ARRAY An array of posts to be inserted to the database, each post in the array the same as a single to insert_post()
    Example Query:
    http://www.example.com/admin/edit/mdb_buildings/plain/api?method=insert_posts&hash=abcd&posts=ARRAY
  • failed response


       <insert_posts>
          <response>
             <message>2 errors</message>
             <log>
                <line2>
                   <building>building can not be NULL</building>
                </line2>
                <line3>
                   <building>building can not be NULL</building>
                </line3>
             </log>
          </response>
          <status>failed</status>
       </insert_posts>
  • success response


       <insert_posts>
          <response>
             <message>100 successes, 0 errors, 100 processed</message>
          </response>
          <status>success</status>
       </insert_posts>
#inlineditbutton