Hoppa direkt till innehåll
Import to Marknadsdatabasen
FormatXML AuthLogin OriginStadsnät ConsumerMarknadsdatabasen
insert_posts
ARRAY should be an array of arrays with PHP notation, as such: posts=MNCMSN&posts=Hallstahammar&posts=... 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=MNCMSN)

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

Se example of using this method here
  • Request

    GET /admin/edit/mdb_buildings/plain/api
    • Attributes

    • Example request

      GET /admin/edit/mdb_buildings/plain/api?method=insert_posts&posts=ARRAY&hash=abcd
    • Response success: 200

      HTTP/1.1 200
      Content-Type: application/xml
        <insert_posts>     <response>       <message>100 successes, 0 errors, 100 processed</message>     </response>     <status>success</status>   </insert_posts>
    • Response failed: 400

      HTTP/1.1 400
      Content-Type: application/xml
        <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>