api

Atlas API

Methods
API Endpoint: Edit
Use this API to edit data in Marknadsdatabasen 2. One big difference between MdB1 and MdB2 is that MdB2 is split into several databases. The name of the databases are:
  • buildings
  • building_addresses
  • building_premises
  • building_sockets


Every accessID is connected to a building, address and possibly a premise. A premise is connected to an address and an building. An address is connected to a building. If a single building has 10 addresses, 40 premises and 45 accessID and you edit the name of one of the addresses, it will still be connected to that premise, but the change will cascade down to all data that is connected to that address, such as premises and accessID's.
Endpoint URL http://www.example.com/admin/edit/mdb_buildings/plain/editapi
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
  • Method: delete

  • Information


    WARNING!
    This will totally delete a post in the database, there is no recovery function via API. The API user needs to have delete access in Atlas Admin. There will be a backup and log of the delete, but only for this particular post, if you delete an address that will also lead to deleting all premises and accessId's connected to that address post. There is no automatic backup of those posts.
  • Parameters
    1 hash string green ABC123 Hash from api_login()
    2 database string green buildings What database to read data from. Valid values are "buildings", "building_addresses", "building_premises" and "building_sockets"
    3 id int green 1234 ID of post to delete in selected database
    Example Query:
    http://www.example.com/admin/edit/mdb_buildings/plain/editapi?method=delete&hash=ABC123&database=buildings&id=1234
  • success response


       <delete>
          <response>
             <message>post 3911 from building_addresses deleted</message>
          </response>
          <status>success</status>
       </delete>
  • Method: edit

  • Information


    When editing a post, the data value should be sent with PHP array notation. Not all fields need to be supplied. If you want to edit the streetName and streetNumber value of the address with id 1234, an example call would be:

    /admin/edit/mdb_buildings/plain/editapi?method=edit&hash=HASH &database=building_addresses&id=1234&data[streetName]=NewStreetName &data[streetNumber]=12
    Please note that editing data in a database propagates that data to other posts. Editing the streetName of an address means that all premises and accessID's connected to this address will have a new streetName
  • Parameters
    1 hash string green ABC123 Hash from api_login()
    2 database string green buildings What database to read data from. Valid values are "buildings", "building_addresses", "building_premises" and "building_sockets"
    3 id int green 1234 Id of post to read data from
    4 data string green Array Data to update
    Example Query:
    http://www.example.com/admin/edit/mdb_buildings/plain/editapi?method=edit&hash=ABC123&database=buildings&id=1234&data=Array
  • failed response


       <edit>
          <response>
             <message>The data you supplied does not validate for building_addresses</message>
             <errors>postalCode must be a number, postalCode must have a max length of 5</errors>
          </response>
          <status>failed</status>
       </edit>
  • Method: read

  • Parameters
    1 hash string green ABC123 Hash from api_login()
    2 database string green buildings What database to read data from. Valid values are "buildings", "building_addresses", "building_premises" and "building_sockets"
    3 id int green 1234 Id of post to read data from
    Example Query:
    http://www.example.com/admin/edit/mdb_buildings/plain/editapi?method=read&hash=ABC123&database=buildings&id=1234
  • success response


       <read>
          <response>
             <building_addresses>
                <propertyUnitDesignation>1061</propertyUnitDesignation>
                <streetName>Skogsvägen</streetName>
                <streetNumber>26</streetNumber>
                <postalCode>72134</postalCode>
             </building_addresses>
          </response>
          <status>success</status>
       </read>
  • Method: relations

  • Information


    Get related posts to a specific database post. If you want to see what accessId's are connected to a specific premises or address for instance.
  • Parameters
    1 hash string green ABC123 Hash from api_login()
    2 database string green buildings What database to read data from. Valid values are "buildings", "building_addresses", "building_premises" and "building_sockets"
    3 id int green 1234 Id of post to get connections to
    Example Query:
    http://www.example.com/admin/edit/mdb_buildings/plain/editapi?method=relations&hash=ABC123&database=buildings&id=1234
  • success response


       <relations>
          <response>
             <connections>
                <building_sockets>
                   <post>4720</post>
                </building_sockets>
                <building_premises>
                   <post>2937</post>
                </building_premises>
             </connections>
          </response>
          <status>success</status>
       </relations>
  • Method: search

  • Information


    Use the search function to find the ID of the information in the seperate databases. If you want to edit any of the address information, use the value in "address_id" when using the read/delete/edit methods
  • Parameters
    1 hash string green ABC123 Hash from api_login()
    2 search string green Skogsvägen Search string
    3 mode string green address Search mode, valid values are "address" or "accessid"
    Example Query:
    http://www.example.com/admin/edit/mdb_buildings/plain/editapi?method=search&hash=ABC123&search=Skogsv%C3%A4gen&mode=address
  • success response


       <search>
          <response>
             <result>
                <coId>SNFDMO</coId>
                <accessId>81883</accessId>
                <streetName>Skogsvägen</streetName>
                <streetNumber>26</streetNumber>
                <postalCode>72134</postalCode>
                <city>Västerås</city>
                <countryCode>SE</countryCode>
                <premisesType>RESIDENTIAL_HOUSE</premisesType>
                <propertyUnitDesignation>GALTEN 26</propertyUnitDesignation>
                <population>Bäckby</population>
                <media>FTTH</media>
                <services>100/100</services>
                <collectiveServices>NO</collectiveServices>
                <servicesConnection>2016-02-16</servicesConnection>
                <coCpe>MODELL1259</coCpe>
                <servicePort>ASAP</servicePort>
                <lastUpdate>2016-09-26 12:34:50</lastUpdate>
                <netType>LAYER3</netType>
                <portCapacity>100000</portCapacity>
                <cpeCapacity>100000</cpeCapacity>
                <openTv>NO</openTv>
                <cableTv>NO</cableTv>
                <exclusiveTv>DELIVERABLE</exclusiveTv>
                <propertyOwnerPostalCode>0</propertyOwnerPostalCode>
                <activeServices>UNKNOWN</activeServices>
                <socket_id>4720</socket_id>
                <address_id>3911</address_id>
                <building_id>1061</building_id>
             </result>
          </response>
          <status>success</status>
       </search>
#inlineditbutton