Import JSON Files

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.

Hi All,

I have created a sript that creates n multiple JSON files for testing endpoints. When trying to import them they i keep getting the not recognised error.
is there anyway of importing the files as JSON?
Also has anyone done this and being able to add endpoints and environment to the files.

Thanks in Advanced for any help

Gearoid

Hey @Gearoid_Aspen

Welcome to the community! :wave:

Could you provide some more details about how you’re importing these into the application? Is this via the Import button? Also, any details about the format/structure would help people provide an answer. :slight_smile:

The Import feature would only import specific types:

Import a Postman Collection, Environment, data dump, curl command, or a RAML / WADL / Open API (1.0/2.0/3.0) / GraphQL Schema / Runscope file.

https://learning.getpostman.com/docs/postman/collections/data-formats/#importing-postman-data

Hey @dannydainton
Ill give you a brief run through of what i am a doing. I
have a power-shell script that creates JSON files for testing my API endpoints.
what i want to try figure out is how i get these into postman i know you can import JSON files.
I was just wondering did anyone else come across this before if so how did they do it.

I know not straight forward but sure its a challenge :smiley:

Thanks for getting back to me.

How are the JSON files used? How are they structured? Could you provide an example, please?

JSON files, in a specific format, can only be used within the application. The main one being an exported Postman Collection, which can be imported to create a new Collection in your Postman instance.

JSON files could also be used in the Collection Runner, this would contain different sets of data that can be picked up by the individual Requests, when the {{testVar}} or pm.iterationData.get('testVar') syntax is used in specific parts of the request builder.

The structure of this would be something like:

[
    {
        "testVar": "TestValue1"    
    },
    {
        "testVar": "TestValue2"    
    }
]

There are a couple of other ways that JSON files could be used but these would also be in a very specific format. The application wouldn’t import a JSON file if the format is not valid or is not one that can be used in the different parts of the app.

@dannydainton
Hi Danny,

What I was going to do is import them and use an environment to run the endpoint test.

So what I would do is create a new task input that taskID into my script that will generate all the JSON’s I need to test all of the endpoints.

I also need to add the authorisation and endpoint URL. If you think there is a better way I am open to any suggestions.

The format will be like this:

{
    "Preservation": {
        "Status":"Ordered",
        "StatusReason":null,
        "StatusComment":null,
        "StatusDate":"2020-01-10T04:40:00"
    }
}

Thanks Again for your help Danny

I’m still not 100% sure how you’re using the data in the files you’re creating.

Can you provide an example of how this currently looks for you in the app?

Is this a sample of the request body that you want to use?

{
    "Preservation": {
        "Status":"Ordered",
        "StatusReason":null,
        "StatusComment":null,
        "StatusDate":"2020-01-10T04:40:00"
    }
}

I have to edit the file at the moment and paste them in to a new request add in the URL and set a basic user authorisation.

what i am looking to do is cut out the manual side of things . I know easier said then done :roll_eyes:
that is a section of a sample JSON below is a full one with out URL and Authorisation.

{“Preservation”:{“Status”:“Ordered”,“StatusReason”:null,“StatusComment”:null,“StatusDate”:“2020-01-10T04:40:00”,“OrderPriority”:“Standard”,“VendorDueDate”:“2020-01-17T09:39:00”,“WorkOrderOpenDate”:“2020-01-10T04:39:00”,“WorkOrderNumber”:“T0021258700”,“AssetNumber”:“20963”,“ClientPerson”:“Tammy West”,“Description”:“Please review the suggested service and provide photographic evidence in the supporting documentations and photos section to support the completed work.”,“SpecialInstructions”:"",“TaskTemplateIdGlobal”:“1E8D2F03-6C7E-4EB0-B89A-4A4E58B4AD7D”,“VendorWorkOrderNumber”:""},“VendorSuggestedServices”:[{“Service”:“Lawn Maintenance - Initial Cut”,“ServiceIdGlobal”:“a22a3c01-93a8-4e18-a6f6-d905e7d8c042”,“ServiceType”:“Lawn Care - less than or equal to 10,000 sq. ft. Initial Cut - Per\”",“ServiceTypeIdGlobal”:“7148678e-8cdf-fa66-ed51-2b07c0043927”,“Quantity”:1,“VendorPrice”:“220.00”,“VendorWorkOrderNumber”:“xxx”}],“TransmissionId”:“89E0FEC6-896E-4478-9D64-9B730A6B0C0B”,“OrganizationIdGlobal”:“5D606521-8E59-4B98-BB4D-65CC76EF5D77”,“SystemIdGlobal”:“33822469-D2B5-4F30-BEA9-D146EE2E6700”}