Shopware 6 API download document - json

I want to download a specific document file and got response from the API api/document/{hash_id}:
{"id":"23614d7684674b7dbad6418e59f13928",
"type":"document",
"attributes":{
"documentTypeId":"49f26db78a0843d0ab3584ae9a2aa442",
"fileType":"pdf",
"referencedDocumentId":null,
"orderId":"1305194870b24694aa3e6245ab1c0338",
"documentMediaFileId":null,
"orderVersionId":"d27aeb28a907472ab37205ae6fd58842",
"config":{
"extensions":[
],
"displayPrices":false,
"logo":null,
"filenamePrefix":"delivery_note_",
"filenameSuffix":"",
"documentNumber":"1002",
"documentDate":"2023-02-03T09:10:23.047Z",
"documentComment":"sdasdasdsadasdadasdssadas",
"pageOrientation":"portrait",
"pageSize":"a4",
"displayFooter":true,
"displayHeader":true,
"displayLineItems":true,
"displayLineItemPosition":null,
"itemsPerPage":10,
"displayPageCount":true,
"displayCompanyAddress":true,
"title":null,
"companyAddress":"",
"companyName":"Example Company",
"companyEmail":null,
"companyUrl":null,
"taxNumber":"",
"taxOffice":"",
"vatId":"",
"bankName":"",
"bankIban":"",
"bankBic":"",
"placeOfJurisdiction":"",
"placeOfFulfillment":"",
"executiveDirector":"",
"custom":{
"deliveryDate":"2023-02-03T09:10:22.729Z",
"deliveryNoteDate":"2023-02-03T09:10:22.729Z",
"deliveryNoteNumber":"1002"
},
"translated":[
],
"name":"delivery_note",
"global":true,
"documentTypeId":"49f26db78a0843d0ab3584ae9a2aa442",
"id":"edeb46dd249041c2bf6861a4f712d388",
"diplayLineItemPosition":true
},
"sent":false,
"static":false,
"deepLinkCode":"7IvHlgSqgE637zJISdEskEtMn34czg1v",
"customFields":null,
"createdAt":"2023-02-03T09:10:32.313+00:00",
"updatedAt":null,
"apiAlias":null
}}
How can I build a url from the above json?

Related

How Can I make a list automatically with Json for my Angular project?

My json is :
{
"exp": [
{
"first": "bla",
"second": "blabla",
"desp": [
{
"line": "Instant Apzel bestseller"
},
{
"line": "Translated into 18 languages"
},
{
"line": "Most Recommended Book of the year."
},
{
"line": "A neglected project, widely dismissed, its champion written off as unhinged."
},
{
"line": "Yields a negative result in an experiment because of a flaw in the design of the experiment"
},
{
"line": "An Amazon, Bloomberg, Financial Times, Forbes, Inc., Newsweek, Strategy + Business, Teech Crunch, Washinton Post Best Business Book oof the year"
}
]
}
]
}
in html with angular how can I call this json data with easyly?
Cause now I do like that;
<p>{{item.description.desSummary}}</p>
<ul class="desc-content">
<li>{{item.description.desList.lineMono}}</li>
<li>{{item.description.desList.lineDi}}</li>
<li>{{item.description.desList.lineTri}}</li>
<li>{{item.description.desList.lineTetra}}</li>
<li>{{item.description.desList.linePenta}}</li>
<li>{{item.description.desList.lineHexa}}</li>
</ul>
and json like that:
"desList": {
"lineMono": "Instant Apzel bestseller",
"lineDi": "Translated into 18 languages",
"lineTri": "Most Recommended Book of the year.",
"lineTetra": "A neglected project, widely dismissed, its champion written off as unhinged.",
"linePenta": "Yields a negative result in an experiment because of a flaw in the design of the experiment",
"lineHexa": "An Amazon, Bloomberg, Financial Times, Forbes, Inc., Newsweek, Strategy + Business, Teech Crunch, Washinton Post Best Business Book oof the year"
}
I want to do that with just one code block like this:
> <div *ngFor=let item of exp>
> <ul><li>{{item.desp.line}}<li/><ul/>
> <div/>
How can I do like that. I tryed but there is some problems.
Use this way -
<div *ngFor="let item of data.exp" class="item">
<p class="first">{{ item.first }}</p>
<p class="second">{{ item.second }}</p>
<div class="desp-list" *ngFor="let desp of item.desp">
<p class="desp-item">{{ desp.line }}</p>
</div>
</div>
See this working example here with your data.
Edit: See a working example with data from a json file, here

Separate and display multiple json value in different span tag in reactjs

I have a json object called blogData with json data. Inside the json obj the tags key may have multiple tag values. I would like to display the tags values separately in span tag while iterating using map function.
Now multiple tags are displaying in a single span tag ( please see below) How can I fix this ?
const blogData = [
{
"id" : 1,
"title":"Cypress tests",
"images":"/images/image1.jpg",
"description": "Add the E2E cypress UI tests",
"tags": "cypress"
},
{
"id" : 2,
"title":"Jmeter tests",
"images":"/images/image2.jpg",
"description": "Performance test using Jmeter tool",
"tags": ["jmeter", "performance"]
},
{
"id" : 3,
"title":"Basic Unix commands",
"images":"/images/image3.jpg",
"description": "Learn basic unix commands in git bash",
"tags": "unix"
},
{
"id" : 4,
"title":"Postman",
"images":"/images/image4.jpg",
"description": "Api testing using postman",
"tags": ["postman", "api"]
},
]
Home.js
const [searchResults, setSearchResults] = useState([]);
<div className="container">
{
searchResults.map(({ id, title, images, description, tags }) => (
<div key={id} className="column-center">
{/* <img className="blogImage" key={images} src={images} alt="image"></img> */}
<div className="blogtitle">
<span key={title}>{title}</span>
</div>
<section>
<p className="blogdescription" key={description}>{description}</p>
</section>
<section className="col1">
<span key={tags}>{tags}</span>
</section>
<section className="col2">
<a>Read more {'>'}{'>'}</a>
</section>
</div>
))
}
</div>
I think this what you are after.
Sandbox
<section className="col1">
{Array.isArray(tags) ? (
tags.map((tag) => (
<span style={{ marginRight: "10px" }}>{tag}</span>
))
) : (
<span>{tags}</span>
)}
</section>
You could make this code much simpler be having the tags field always be an array even if there is a single element.

How to open an html page that contains the information from a json file, another page that contains details of only specefic data of the json file

Sorry I couldn't put a good title but I hope you will understand my question.
In my html page, I am using AngularJS to show some informations here's my code:
<tr ng-repeat="d in list">
<td>{{d.nm}}</td>
<td>{{d.cty}}</td>
<td>{{d.hse}}</td>
<td>{{d.yrs}}</td>
</tr>
Now what I want to do in the actual page is to show only the name, link this page to another one that contains the details in order to get cleaner pages.
So here's my plan
<tr ng-repeat="d in list">
<td ng-href="details.html">{{d.nm}}</td>
</tr>
and in details.html I want to show only the details about the name I clicked on.
For example if I have:
{
["nm": "xxx",
"cty": "yyy",
"hse": "zzz",
"yrs": 2016
],
["nm": "aaa",
"cty": "bbb",
"hse": "ccc",
"yrs": 2014
]
}
So If I click on xxx in my home page, in details.html I should get only yyy, zzz and 2016 etc...
Is that possible?
EDit
app.factory('myapp', ['$http', function($http) {
function getLists() {
var tab = ['url1', 'url2', 'url3'];
var list = [];
for(i = 0; i < tab.length; i++) {
$http.get(tab[i])
.then(function(res) {
list.push(res.data);
});
}
return list;
}
return {
getLists: getLists
};
]);
Controller:
$scope.list = myapp.getLists();
If they are in same controller
<tr ng-repeat="d in list">
<td ng-href="details.html" ng-click="getDetails(d)">{{d.nm}}</td>
</tr>
in Controller :
$scope.getDetails = function(data){
$scope.selectedData = data;
}
In details.html :
<tr ng-repeat="d in selectedData">
<td>{{d.nm}}</td>
<td>{{d.cty}}</td>
<td>{{d.hse}}</td>
<td>{{d.yrs}}</td>
</tr>
And the JSON you provided is not a valid one
change that to :
[
{"nm": "xxx",
"cty": "yyy",
"hse": "zzz",
"yrs": 2016
},
{"nm": "aaa",
"cty": "bbb",
"hse": "ccc",
"yrs": 2014
}
}

How do I make JSON data file objects use a layout

First, I'm using GitHub Pages dependencies.
I'm trying to make use of Jekyll's data files, but I'm having problem making functional links that would use a layout to display more of the object's contents.
I can access the page via the url: http://127.0.0.1:4000/dev/ - and my for loop at ./dev/index.html shows as it should. If I click any links on that page I get a 404 message because e.g: http://127.0.0.1:4000/dev/parent/child couldn't be found.
The posts in Jekyll use Front Matter to determine which layout it should use, but I don't know how to make my links to use my custom layout when I click any of the links in ./dev/index.html.
How can I create a "link" between the urls in ./dev/index.html to display the ./_layouts/post.html?
Here's what I got so far.
./_data/dev.json:
[
{
"id": 0,
"name": "I am (g)Root",
"link": "parent",
"data": [
{
"id": 0,
"name": "Some kid",
"content": "bla bla bla",
"link": "child"
},
{
"id": 1,
"name": "A desk",
"content": "texty texty",
"link": "desk"
}
]
}
]
./dev/index.html
---
layout: page
title: 'dev'
published: true
date: 2015-10-03 18:48:58 +02:00
category: 'module'
---
{% assign data = site.data.dev.first %}
{% for post in data.data %}
<ul>
<!-- URL will look like this: /parent/child -->
<li>{{ post.name }}</li>
</ul>
{% endfor %}
./_layouts/post.html
---
layout: default
---
{{ content }}
./_config.yml
permalink: /:categories/:title
Data files are just datas that you can consume in loops. Without a generator plugins you're not able to generate pages from them.
In order to generate page from "datas" you can use collections.

HandlebarsJS - How to display nested JSON

I have this Backbone App where I display my data/json with HandlebarsJS.
Now my API returns nested JSON data:
{
"Live": [
{
"artist_name": "some artist",
"video_title": " some video title",
"video_thumbnail": "some thumbnail"
}
],
"Others" : [
{
"artist_name": "some artist",
"video_title": " some video title",
"video_thumbnail": "some thumbnail"
}
]
}
I tried to do
{{#each Live}}
<div>
<img src="{{video_thumbnail}}">
<h2>{{video_title}}</h2>
<h2>{{artist_name}}</h2>
</div>
{{/each}}
But that did not work...
Anyone who know what to do? thanks in advance...
Handlebar templates can be used in two ways.
1. We can save the file with (.hbs)
2. Second way is we need the handlebar template in script tag. Provided same in [jsfiddle][1] , I have provided link, you can check the below link
[1]: https://jsfiddle.net/trilokvallamkonda/cLgzf21y/13/