locked
json to sharepoint list RRS feed

  • Question

  • Hi,

    I'm finding a lot of info on how to get a sharepoint list out to json. But I need it the other way around.

    There are three "fields" in a json file that I need to import into three columns of a sharepoint list. Here is an example of what I use to get the json data.  http://str/myrule2json.php?RULE=MYDATA&FIELD=MyField

    Can anyone point me in the right direction? Thanks.

    Friday, July 29, 2016 7:17 AM

Answers

All replies

  • Hi,

    You can use jQuery ajax CRUD operation to address your need, you can make a POST call,

    User below sample code,

    jQuery.ajax({
            url: "http://<site url>/_api/web/lists",
            type: "POST",
            data:  JSON.stringify({ '__metadata': { 'type': 'SP.List' }, 'AllowContentTypes': true,
     'BaseTemplate': 100, 'ContentTypesEnabled': true, 'Description': 'My list description', 'Title': 'Test' }
    ),
            headers: { 
                "accept": "application/json;odata=verbose",
                "content-type": "application/json;odata=verbose",
                "content-length": <length of post body>,
                "X-RequestDigest": $("#__REQUESTDIGEST").val()
            },
            success: doSuccess,
            error: doError
    });
    
    
    

    Reference link : https://msdn.microsoft.com/en-us/library/office/jj164022.aspx

    http://stackoverflow.com/questions/29626887/javascript-with-sharepoint-2013-rest-endpoint-insert-into-list

    Please let me know in case any further clarification required on the same.


    Hope this help.

    Vote - if you find this helpful

    Marked as Answer - if you see this reply being an answer to the question of the thread


    Regards,

    Amjad Khan

    Blog: https://amjadk.com

    Friday, July 29, 2016 7:31 AM
  • Wow, that's great Amjad.  I will get going to see if I can get it working. Thanks so much. I'll vote and mark it as an answer as soon as I can get it working. Again, thank you.
    Friday, July 29, 2016 8:51 PM
  • Thanks IJ712,

    For your respose, hope it should work.

    Please mark these threads as Answered, once you through.


    Hope this help.

    Vote - if you find this helpful

    Marked as Answer - if you see this reply being an answer to the question of the thread


    Regards,

    Amjad Khan

    Blog: https://amjadk.com

    Saturday, July 30, 2016 9:46 AM