View | Details | Raw Unified | Return to bug 41618
Collapse All | Expand All

(-)a/Koha/REST/V1/Biblios.pm (-5 / +10 lines)
Lines 68-74 sub get { Link Here
68
            );
68
            );
69
        } else {
69
        } else {
70
            my $metadata = $biblio->metadata;
70
            my $metadata = $biblio->metadata;
71
            my $record   = $metadata->record( { embed_items => 1 } );
71
72
            my $embed = $c->stash('koha.embed');
73
            my $record = $metadata->record( { embed_items => (exists $embed->{items} ? 1 : 0) } );
74
72
            my $schema   = $metadata->schema // C4::Context->preference("marcflavour");
75
            my $schema   = $metadata->schema // C4::Context->preference("marcflavour");
73
76
74
            $c->respond_to(
77
            $c->respond_to(
Lines 781-786 sub list { Link Here
781
    my $biblios = $c->objects->search_rs( $rs, [ ( sub { $rs->api_query_fixer( $_[0], '', $_[1] ) } ) ] );
784
    my $biblios = $c->objects->search_rs( $rs, [ ( sub { $rs->api_query_fixer( $_[0], '', $_[1] ) } ) ] );
782
785
783
    return try {
786
    return try {
787
        my $embed = $c->stash('koha.embed');
788
        my $embed_items = exists $embed->{items} ? 1 : 0;
784
789
785
        if ( $c->req->headers->accept =~ m/application\/json(;.*)?$/ ) {
790
        if ( $c->req->headers->accept =~ m/application\/json(;.*)?$/ ) {
786
            return $c->render(
791
            return $c->render(
Lines 791-814 sub list { Link Here
791
            $c->res->headers->add( 'Content-Type', 'application/marcxml+xml' );
796
            $c->res->headers->add( 'Content-Type', 'application/marcxml+xml' );
792
            return $c->render(
797
            return $c->render(
793
                status => 200,
798
                status => 200,
794
                text   => $biblios->print_collection('marcxml', 1)
799
                text   => $biblios->print_collection('marcxml', $embed_items)
795
            );
800
            );
796
        } elsif ( $c->req->headers->accept =~ m/application\/marc-in-json(;.*)?$/ ) {
801
        } elsif ( $c->req->headers->accept =~ m/application\/marc-in-json(;.*)?$/ ) {
797
            $c->res->headers->add( 'Content-Type', 'application/marc-in-json' );
802
            $c->res->headers->add( 'Content-Type', 'application/marc-in-json' );
798
            return $c->render(
803
            return $c->render(
799
                status => 200,
804
                status => 200,
800
                data   => $biblios->print_collection('mij', 1)
805
                data   => $biblios->print_collection('mij', $embed_items)
801
            );
806
            );
802
        } elsif ( $c->req->headers->accept =~ m/application\/marc(;.*)?$/ ) {
807
        } elsif ( $c->req->headers->accept =~ m/application\/marc(;.*)?$/ ) {
803
            $c->res->headers->add( 'Content-Type', 'application/marc' );
808
            $c->res->headers->add( 'Content-Type', 'application/marc' );
804
            return $c->render(
809
            return $c->render(
805
                status => 200,
810
                status => 200,
806
                text   => $biblios->print_collection('marc', 1)
811
                text   => $biblios->print_collection('marc', $embed_items)
807
            );
812
            );
808
        } elsif ( $c->req->headers->accept =~ m/text\/plain(;.*)?$/ ) {
813
        } elsif ( $c->req->headers->accept =~ m/text\/plain(;.*)?$/ ) {
809
            return $c->render(
814
            return $c->render(
810
                status => 200,
815
                status => 200,
811
                text   => $biblios->print_collection('txt', 1)
816
                text   => $biblios->print_collection('txt', $embed_items)
812
            );
817
            );
813
        } else {
818
        } else {
814
            return $c->render(
819
            return $c->render(
(-)a/api/v1/swagger/paths/biblios.yaml (-1 / +20 lines)
Lines 78-83 Link Here
78
      - $ref: "../swagger.yaml#/parameters/q_param"
78
      - $ref: "../swagger.yaml#/parameters/q_param"
79
      - $ref: "../swagger.yaml#/parameters/q_body"
79
      - $ref: "../swagger.yaml#/parameters/q_body"
80
      - $ref: "../swagger.yaml#/parameters/request_id_header"
80
      - $ref: "../swagger.yaml#/parameters/request_id_header"
81
      - name: x-koha-embed
82
        in: header
83
        required: false
84
        description: Embed list sent as a request header
85
        type: array
86
        items:
87
          type: string
88
          enum:
89
            - items
90
        collectionFormat: csv
81
    produces:
91
    produces:
82
      - application/json
92
      - application/json
83
      - application/marcxml+xml
93
      - application/marcxml+xml
Lines 136-141 Link Here
136
    summary: Get biblio
146
    summary: Get biblio
137
    parameters:
147
    parameters:
138
      - $ref: "../swagger.yaml#/parameters/biblio_id_pp"
148
      - $ref: "../swagger.yaml#/parameters/biblio_id_pp"
149
      - name: x-koha-embed
150
        in: header
151
        required: false
152
        description: Embed list sent as a request header
153
        type: array
154
        items:
155
          type: string
156
          enum:
157
            - items
158
        collectionFormat: csv
139
    produces:
159
    produces:
140
      - application/json
160
      - application/json
141
      - application/marcxml+xml
161
      - application/marcxml+xml
142
- 

Return to bug 41618